title: Using one thread to do a specific task multiple times C#
body: <p>I have a class that works with a device, to avoid delays in UI layer when working with device and serial port I used a thread, but my device is limited to do only one job at a time.
  So, I have a queue that when user asks to do something tasks got added to it, then I run a thread to do tasks one by one.</p>
  
  <p>Every time user asks for a task I check if the thread is running or not, if yes I just add new task to queue, if not I create thread again. Which means each time queue got empty, I should create a new thread. Now I want to ask is there any way to reuse the thread? Since I just need one thread to do tasks is it a good idea to use threadpool? Since suspend is an obsolete method and I don't know when the user would ask for another task to use wait(), can I suspend thread and run it again in any other way? or It is best to create thread again and I'm doing it right?</p>
  
  <pre><code>public class Modem
  {
      Thread thread;
      Queue&lt;Task&gt; Tasks = new Queue&lt;Task&gt;();
      public Modem()
      {
      }
  
      public void DoTask(Task s)
      {
          Tasks.Enqueue(s);
          if (thread == null || !thread.IsAlive)
             thread = new Thread(HandleTasks);
      }
  
      private void HandleTasks()
      {
          while (Tasks.Count != 0)
              SendTaskToModem(Tasks.Dequeue());
      }
  }
  </code></pre>