title: Check if task is already running before starting new
body: <p>There is a process which is executed in a task.  I do not want more than one of these to execute simultaneously.</p>
  
  <p>Is this the correct way to check to see if a task is already running?</p>
  
  <pre><code>private Task task;
  
  public void StartTask()
  {
      if (task != null &amp;&amp; (task.Status == TaskStatus.Running || task.Status == TaskStatus.WaitingToRun || task.Status == TaskStatus.WaitingForActivation))
      {
          Logger.Log("Task has attempted to start while already running");
      }
      else
      {
          Logger.Log("Task has began");
  
          task = Task.Factory.StartNew(() =&gt;
          {
              // Stuff                
          });
      }
  }
  </code></pre>