What is the impact of Thread.Sleep(1) in C#?
- by Justin Tanner
In a windows form application what is the impact of calling Thread.Sleep(1) as illustrated in the following code:
public Constructor()
{
Thread thread = new Thread(Task);
thread.IsBackground = true;
thread.Start();
}
private void Task()
{
while (true)
{
// do something
Thread.Sleep(1);
}
}
Will this thread hog all of the available CPU?
What profiling techniques can I use to measure this Thread's CPU usage ( other than task manager )?