Monitor.Wait and Monitor.Enter
What's difference between two method? Monitor.Wait() and Monitor.Enter().Can you help me?
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.
Posted Oct 15, 2007, 5:44 AM
the object
Monitor.Wait
[When a thread calls Wait, it releases the lock on the object and enters the
object's waiting queue.
The thread that currently owns the lock on the specified object invokes this
method in order to release the object so that another thread can access it.
The caller is blocked while waiting to reacquire the lock. This method is
called when the caller is waiting for a change in the state of the object
that will occur as a result of another thread's operations on the object.]
AutoResetEvent is used for thread communication via signals. Flavor of
AutoResetEvent is that you have not to call Reset.
abdus salamPosted May 23, 2007, 3:46 AM
Monitor.Wait Releases the lock on an object in order to permit other threads to lock and access the object. The calling thread waits while another thread accesses the object. Pulse signals are used to notify waiting threads about changes to an object's state.