title: Alternatives to giving a task X amount of time to finish
body: <p>It's often the case when I need to get a task done within X amount of seconds and if it doesn't complete, I want to keep going, processing the rest of the tasks</p>
  
  <p>I've been defaulting to something like this:</p>
  
  <pre><code>Thread worker = new Thread(() =&gt; {
      // do some long operation
  });
  
  Thread monitor = new Thread(() =&gt; {
      Thread.Sleep(10000);
      if(worker != null &amp;&amp; worker.IsAlive) {
          worker.Abort();
          worker = null;
      }
      StartNextTask();
  });
  
  monitor.Start ();
  worker.Start();
  </code></pre>
  
  <p>This works, but it is cumbersome because it uses two threads (yes, you can use the <code>Task</code> class as well to use threads from the threadpool). </p>
  
  <p><code>AutoResetEvent</code>s and <code>event</code> based models don't quite work because the former blocks the monitor thread until the worker is done, and the <code>event</code> driven approach relies on the client to call the event and notify the monitor. </p>
  
  <p>Are there alternative patterns to this that can follow the same semantics?</p>