Alternative to Thread Sleep in a while loop

Viewed 5769

In my application I have a small number of threads (5) performing the following method non stop:

private void ThreadMethod()
{
     while(true)
     {
          if(CurrentItem != null)
          {
               HandleCurrentItem();
          }
          Thread.Sleep(200);
     }
}

From what I've seen around this is not a recommended practice, but most of the arguments is because you don't have responsiveness and you cannot cancel the thread or the timing isn't precise. None of those are an issue for me, however I'm concerned about wasting too much CPU resources in this. From what I've seen here at 01:05:35 the processor gets full utilization when you call the Sleep method.

My questions:

Is this a decent solution in my scenario? If not, how to do it better?

Note: I'm using .Net Framework 4.0

Note 2: those threads are located in different instances of a class, so the CurrentItem is a different object for each thread.

4 Answers
Related