Let a thread wait for n number of pulses
c#, multithreading
Solution
Have a look at the CountdownEvent Class:
CountdownEvent Class
Represents a synchronization primitive that is signaled when its count reaches zero.
Example:
CountdownEvent waiter = new CountdownEvent(n);
// notifying thread
waiter.Signal();
// waiting thread
waiter.Wait();
Problem
How can I wait for n number of pulses? ``` … // do something waiter.WaitForNotifications(); ``` I want the above thread to wait until being notified n times (by n different threads or n times by the same thread). I believe there is a type of counter to do this, but I can't find it.