I stuck with choosing synchronization primitive.
This is the case:
I have pool of threads, that are in infinitive loop, and waits for some event. And another thread that should invoke this event. When event fires all wating thread should make one iteration and fall back for waiting event again.
Should I use manualResetEvent for this? I can’t understand, is there any garanty, that if i wrote in control thread something like this
event.Set();
event.Reset();
All waiting threads make iteration, and all waiting threads makes only one, not two ore three, iterations.
Or should I use another primitive for my case?
Use
Monitor.Wait(someObject)in the looping threads, andMonitor.PulseAll(someObject)in the event raising thread.