title: Restarting a task in the background if certain errors occur
body: <p>I am using some REST requests using Mono.Mac (3.2.3) to communicate with a server, and as a retry mechanism I am quietly attempting to give the HTTP actions multiple tries if they fail, or time out.</p>
  
  <p>I have the following;</p>
  
  <pre><code>var tries = 0;
  while (tries &lt;= ALLOWED_TRIES)
  {
      try
      {
          postTask.Start();
          tries++;
          if (!postTask.Wait(Timeout))
          {
              throw new TimeoutException("Operation timed out");
          }
          break;
      } catch (Exception e) {
          if (tries &gt; ALLOWED_TRIES)
          {
              throw new Exception("Failed to access Resource.", e);
          }
      }
  }
  </code></pre>
  
  <p>Where the task uses parameters of the parent method like so;</p>
  
  <pre><code>var postTask = new Task&lt;HttpWebResponse&gt;(() =&gt; {return someStuff(foo, bar);},
      Task.Factory.CancellationToken, 
      Task.Factory.CreationOptions);
  </code></pre>
  
  <p>The problem seems to be that the task does not want to be run again with <code>postTask.Start()</code> after it's first completion (and subsequent failure). Is there a simple way of doing this, or am I misusing tasks in this way? Is there some sort of method that resets the task to its initial state, or am I better off using a factory of some sort?</p>