I want to sync between 2 appdomains, but can't make it work.
I have it:
static void Main(string[] args) { using (Mutex m = new Mutex(true, "Global\\m")) { AppDomain ad = AppDomain.CreateDomain("ad"); var dllName = new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath; ad.CreateInstanceFrom(dllName, typeof(Consumer).FullName); Thread.Sleep(4000); m.ReleaseMutex(); } Console.ReadLine(); }
and
public class Consumer { public Consumer() {
I expect Done to print in 4 seconds, but it will print immediately.
I tried creating a mutex at the consumer using the constructor and using OpenExisting - it does not matter. Do not think that naming the mutex "Global" matters in this case, but tried it.
Something must be missed, and I canโt understand what .. help?
source share