title: Run work on specific thread
body: <p>I would like to have one specific thread, queue for Tasks and process tasks in that separate thread. The application would make Tasks based on users usage and queue them into task queue. Then the separate thread processes the tasks. It is vital to keep the thread alive and use it for processing queued tasks even if queue is empty.</p>
  
  <p>I have tried several implementations of <code>TaskScheduler</code> with <code>BlockingCollection</code> and limit the concurrency to only one thread but it seems the Thread gets disposed when queue gets empty and the Task is processed by other thread.</p>
  
  <p>Can you please at least refer me to some sources how to achieve this goal?</p>
  
  <p>tl;dr
  Trying to limit one specific thread to process tasks which are dynamically added to the queue.</p>
  
  <p>Edit1: </p>
  
  <p>This is experimental web app that uses WCF and .NET framework 4.6. In the WCF library, I am trying to implement this behaviour with one thread processing tasks. This one thread must init prolog using external dll library and then do work with prolog. If other thread is used in process, library throws <code>AccessViolationException</code>. I've done some research and this is most probably because of badly managed threading in that library. I had implementation where I had locks everywhere and it worked. I am now trying to reimplement and make it asynchronous so I don't block the main thread with locking.</p>
  
  <p>I am not at my computer but I provide some code when I get home later today.</p>