0

Two or more instances of application are running under same appdomain, sharing those global variables and UI. Example pressing START at one instance would fire a method on this and all other instances. Except singleton, is there any other way to achieve that separation?

user2818626
  • 43
  • 1
  • 2
  • 8
  • An AppDomain is specific to a process. Can you clarify your question? Are you trying to synchronize two different processes? Or synchronize two different threads inside one process / AppDomain? – Special Sauce Jun 24 '15 at 01:20
  • Hi, to be more exact, 2 different processes are running under same AppDomain. I want them as they are, but to separate global vars and conflicts that occur because of that. For ex. I launch one process, it creates a new module, then another which does the same. First process changes global var "stop" to true; I don't want second process be effected by that. Thank you! – user2818626 Jun 24 '15 at 01:25
  • One AppDomain can only contain one process by definition (please see https://msdn.microsoft.com/en-us/library/2bh4z9hs%28v=vs.110%29.aspx) Are you really trying to say you are running 2 processes (two instances of the same application) and you want them synchronized? – Special Sauce Jun 24 '15 at 01:33
  • I think I haven't been clear, sorry. Basically, two assemblies are being loaded from memory, running under same AppDomain. Those assemblies are identical. When running, they're sharing global vars (which I don't want) I tried instancing both, but didn't work for some reason. If one assembly sets its private var to true, I don't want other assembly to be affected. – user2818626 Jun 24 '15 at 01:44
  • Based on all of your comments, I have to assume you have one process with one AppDomain, and inside that AppDomain you have two or more threads running concurrently. Is this correct? Please refer to http://stackoverflow.com/questions/733868/difference-between-appdomain-assembly-process-and-a-thread for additional distinction. If this is correct, please let me know and then I will answer your question about how to segregate the memory between threads. – Special Sauce Jun 24 '15 at 01:48
  • @user2818626 please make sure to edit your post (including title) with information you've provided in comments. Consider to read about process vs app-domain, assembly and the fact that assemblies by themselves don't "run code" - it is all about instances of classes (and possibly dependency on static data)... – Alexei Levenkov Jun 24 '15 at 02:44

0 Answers0