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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top