views:

119

answers:

2

I have a Windows Service in C#. I want a certain thread to perform specific actions, but only when the CPU is idle. Is there a way to do this in C#.

+6  A: 

You can let the OS handle it for you like this:

Thread thread = Thread.CurrentThread;
thread.Priority = ThreadPriority.Lowest;
280Z28
+2  A: 

Try setting ThreadPriority to BelowNormal or less. See MSDN.

CoderTao