Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

locking with Monitor across AppDomain

$
0
0

I recently had to synchronize threads in a process but possibly in different AppDomains. So I thought of a named Mutex, but while I was poking around MSDN, I noticed this sentence about Monitors from "Overview of Synchronization Primitives":

The Monitor class can provide locking in multiple application domains if the object used for the lock derives from MarshalByRefObject.

My main question is, what does this mean exactly? It sounds to me like if I have an object that derives from MarshalByRefObject, then I can pass an instance from one AppDomain to another and then do "lock(obj) {}" from two different AppDomains. I've tried, and this doesn't work.

So what does the sentence mean?



Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>