title: TPL Queue Processing
body: <p>I'm currently working on a a project and I have a need to queue some jobs for processing, here's the requirement:</p>
  
  <ol>
  <li>Jobs must be processed one at a time</li>
  <li>A queued item must be able to be waited on</li>
  </ol>
  
  <p>So I want something akin to:</p>
  
  <pre><code>Task&lt;result&gt; QueueJob(params here)
  {
     /// Queue the job and somehow return a waitable task that will wait until the queued job has been executed and return the result.
  }
  </code></pre>
  
  <p>I've tried having a background running task that just pulls items off a queue and processes the job, but the difficulty is getting from a background task to the method.</p>
  
  <p>If need be I could go the route of just requesting a completion callback in the QueueJob method, but it'd be great if I could get a transparent Task back that allows you to wait on the job to be processed (even if there are jobs before it in the queue).</p>