Events(WaitHandle) and Monitor

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

Guest

Are AutoReset Event/ManualReset Event and Monitor.Pulse used for the same
purpose?

Can they be used interchangeably?
 
Tim said:
Are AutoReset Event/ManualReset Event and Monitor.Pulse used for the same
purpose?

Can they be used interchangeably?

There are various situations where they can be used for the same
purposes, but there are situations where you *have* to use WaitHandles
(waiting on multiple atomically etc) and many situations where it's
preferable to use Monitors (easier to lock with language support etc).

See http://www.pobox.com/~skeet/csharp/threads/waithandles.shtml for a
general description.

Usually, I'd prefer to use Monitors, but others prefer WaitHandles. I
suspect it depends on your background - I have a Java background, which
uses monitors.
 
Back
Top