Thanks to all. Then, If I need to share the synchronization mechanism
through AppDomain boundaries I need Mutex. Inside the same AppDomain
Monitor is better.

Thanks
Pierre

-----------------------------------------------
Pierre Greborio
[EMAIL PROTECTED]
http://www.pierregreborio.it
-----------------------------------------------



-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED]] On Behalf Of Craig Andera
Sent: Friday, September 20, 2002 4:49 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Mutex and Monitor, any difference ?


> I don't find any conceptual difference between Mutex and Monitor. Can
> someone tell if there are any ?

Mutexes can be named, making them usable across process boundaries.

Monitors have Pulse and Wait functionality, making it easier for you to
lessen the risk of thread starvation.

I suspect that Monitors are implemented to use OS CriticalSections
wherever possible, and that Mutexes use, well, OS Mutexes. That probably
means that Monitors are more efficient, since they don't mandate a
switch into kernel mode. But I haven't spelunked the implementation, so
that's just speculation.

But fundamentally they're both single-owner mutual-exclusion locks.

Maybe MikeW or someone else can think of some other, more fundamental
differences.

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to