Newbie Question about ManualResetEvent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to C#,
what's the difference between lock() and ManualResetEvent.reset()?

for example:
a)
lock(this){
anything....
}

b)

ManualResetEvent _asyncEvent = new ManualResetEvent();

_asyncEvent.reset();
anything.....
_asyncEvent.set();

What's the difference between a) and b)?
Thanks so much!
 
lock is used for reentrancy problems, synchronous access issues via
different objects. It grants exclusive access to a code peice for one part
of the code.
ManualResetEvent is used to synchronize and communicate synch info between
two threads.

-- Sahil Malik
You can reach me thru my blog -
http://www.dotnetjunkies.com/weblog/sahilmalik
 
Back
Top