Delegate BeginInvoke and ManualResetEvent.WaitOne()
Posted on 2008-02-11
Here is an example:
I do something like this when I open Submethods in my app.
I want to know how many submethods I can open.
I think this asynchronous delegate works as a ThreadPool, so if I open more than the pool threads limit (ie 25 threads by default) I will probably have some troubles.
In fact, I don't know how it works in background. In the msdn documentation, ManualResetEvent.WaitOne() blocks the Thread until it receives a signal. But I hope this is not really the case and the Thread is reused in background to run some other jobs because if I have more than 25 waiting threads in the queue my app is dead.
Is ManualResetEvent.WaitOne() really blocking a Thread or is there any job in the ThreadPool to let those waiting Threads not block all others in the queue ?
Thanks in advance for your help.