I've studied that in concurrent programming there's something called "event semaphore" that works like this:
Let's say "sem
" is the event semaphore object.
Threads executing sem.Wait()
are suspended until someone calls sem.signalAll()
that awake any thread waiting on sem.
I can't find anything like this in C#.
The Semaphore
class http://msdn.microsoft.com/it-it/library/system.threading.semaphore.aspx is what i call a counting semaphore, and is not exacly what i need.
The ManualResetEventSlim
http://msdn.microsoft.com/it-it/library/system.threading.manualreseteventslim.aspx is closer and i thought i could achive my goal by calling set();
folowerd by reset();
but i've read that it's not mean to be use like that and it might not awake all waiting thread.
PS, i don't know ho many waiting thread i have, i guess i could count them but i would prefere something like signalAll()
.