Click here to Skip to main content
16,023,339 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi
I would like to know if EventWaitHandle blocks other events to happen?

My problem occurs when I call in main thread eventWaitHandle.WaitOne(), this statement blocks main thread and also events that are important for my second Thread. My second thread is for communicating with controller and is always in while loop to get information from controller. I call eventWaitHandle.Set() somewhere in this loop.

Wich method should i use?

THANK YOU
Posted

1 solution

eventWaitHandle.WaitOne() will block the calling thread until the event is signalled. If you set other events on the same thread they will not get signalled due to your thread still being in WaitOne().

use System.Threading.EventWaitHandle.WaitAll to wait on multiple events on the same thread
 
Share this answer
 
Comments
Dalek Dave 10-Sep-10 9:22am    
Good Answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900