Hello,
I wonder how we can use lock objects between 2 different OOB applications.(Silverlight 5)
In the example below we can use lock objects to let only one thread to execute the code inside the lock object at a time.
This works fine within one application.
Now I wonder how we can use a lock object between 2 different applications. Is there some kind of Global system lock that
can be used?
I have put this code as illustration of what I try to find a solution for:
object lockobject = new object(); //Application 1 void thread1() { Random rnd = new Random(); while (true) { lock (lockobject) { //Allow only 1 application at a time in this code area! } Thread.Sleep(rnd.Next(20, 2000)); } } //Application 2 void thread2() { Random rnd = new Random(); while (true) { lock (lockobject) { //Allow only 1 application at a time in this code area! } Thread.Sleep(rnd.Next(20, 2000)); } }