I cant understand the use of AutoResetEvent.I think I can do the same thing using the Monitor class.
does anybody know an article to explain when there is need to use AutoResetEvent?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Jan 17, 2010, 2:04 PM
I am not familiar with the Monitor class but apparently it is a combination of other things. The most important thing that it is is a critical section; a critical section is a Windows API thing that uses the processor's machine instructions to ensure that something is used by only one thread at a time. An AutoResetEvent is a type of event and the concept of events are used in most multi-tasking (multi-threading) operating systems, including Linux/Unix and other operating systems that existed before Windows.
Did you look at the stuff at the right side of the window in these forums? Look there now; do you see "Our recommended articles"? In there it lists an article about Multithreading; did you read that?
Using AutoResetEvent, it is possible for a thread to wait for multiple events and then process whichever event that has occured. I don't see how that could be done using the Monitor class; it probably can be, but that is one thing I would want to look for if my application would need it.