title: Task.Delay() with long delay in Xamarin.iOS
body: <p>I have a specific requirement where I have to invoke a background thread after <strong>varying interval</strong> of time in <strong>Xamarin.iOS endlessly</strong>. I first tried to implement it using Timer class as explained in <a href="https://docs.microsoft.com/en-us/dotnet/api/system.threading.timer?view=netframework-4.7.2" rel="nofollow noreferrer">this page</a>, but I could not vary the time interval indefinite number of times. </p>
  
  <p>So, I have implemented below solution:</p>
  
  <pre><code>void SomeUIMethod()
  {
      while (true)
      {
          await Task.Run(PerformSync);
      }
  }
  ...
  private async Task PerformSync()
  {
      var newInterval = SomeBackgroundTask();
      Task.Delay(newInterval*1000).Wait();
  }
  </code></pre>
  
  <p>This will invoke the next thread after the new time interval as I expected.</p>
  
  <p>Now, my queries as below:</p>
  
  <ol>
  <li>Is there any other way of achieving this by not having the Thread in delayed state most of the time?</li>
  <li>Does it hamper App performance in any manner? considering that there would be atmost one background Thread in delayed state.</li>
  </ol>