If I Wait
on a Pulse
from Monitor.Wait()
as in the example below, does the system still schedule the waiting thread (including context switching it) and check a condition before yielding the time slice?
Or is the thread not scheduled again, and 'woken' up by the kernel when another thread calls Monitor.Pulse()
?
Monitor.Enter(LOCK_OBJ);
Monitor.Wait(LOCK_OBJ);
Monitor.Exit(LOCK_OBJ);
The reason I ask, is that I want to avoid context switching unnecessarily while a thread waits for a long time. Basically, I want to 'hibernate' the thread.