Top "Waithandle" questions

What is the difference between Thread.Sleep(timeout) and ManualResetEvent.Wait(timeout)?

Both Thread.Sleep(timeout) and resetEvent.Wait(timeout) cause execution to pause for at least timeout milliseconds, so is there …

c# multithreading timeout sleep waithandle
Workaround for the WaitHandle.WaitAll 64 handle limit?

My application spawns loads of different small worker threads via ThreadPool.QueueUserWorkItem which I keep track of via multiple ManualResetEvent …

c# multithreading waithandle
How to check if the WaitHandle was set?

I have a WaitHandle and I would like to know how to check if the WaitHandle has already been set …

c# waithandle
How do I unblock threads which have called the WaitOne method on an AutoResetEvent object?

Below is a class having the method 'SomeMethod' that illustrates my problem. class SomeClass { AutoResetEvent theEvent = new AutoResetEvent(false); // more …

c# .net waithandle compact-framework2.0 waitone
AutoResetEvent.WaitOne with timeout vs Thread.Sleep

I need a solution to perform arbitrary pause. The delay accuracy is irrelevant. What is the practical difference in such …

c# .net multithreading waithandle
Async/await tasks and WaitHandle

Say I have 10N items(I need to fetch them via http protocol), in the code N Tasks are started …

c# asynchronous task waithandle async-await
Do I need to call Close() on a ManualResetEvent?

I've been reading up on .NET Threading and was working on some code that uses a ManualResetEvent. I have found …

c# multithreading dispose waithandle resource-leak
What's the proper way to wait on a Semaphore?

I thought that the following code would let all the 10 threads run, two at a time, and then print "done" …

c# .net multithreading semaphore waithandle
Best approach to Timeout using HttpWebRequest.BeginGetResponse

HttpWebRequest.BeginGetResponse doesn´t respect any Timeout properties from HttpWebRequest(Timeout or ReadWriteTimeout). I read some approaches to get the …

c# asynchronous httpwebrequest timeout waithandle
WaitHandle.WaitAny and Semaphore class

Edit: I'd like to plead temporary insanity for even asking this question, but it made sense at the time (see …

c# .net multithreading waithandle