See the full source code and explanation in my Tips/Tricks article:
Simple Blocking Queue for Thread Communication and Inter-thread Invocation[
^]. It solves exactly the same problem, only in a cultured way, using generics.
You're
very confused with threading, not just
WaitOne
. When a thread is calling a blocking code such as
WaitOne
it is "sleeping" using zero CPU time. The thread simply switched of and never scheduled for execution again until it is "waken up".
EventWaitHandle.Set
of the same instance makes the thread in wait state wake up. There is no loop at all. That you probably have in mind is called "spin-wait" and is the absolute evil.
—SA