[remoting] Increment the context ID counter atomically.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Wed, 29 Apr 2015 06:59:16 +0000 (08:59 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Tue, 5 May 2015 23:30:51 +0000 (01:30 +0200)
mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs

index 7b8c0dfd92063a89d2543afc13374d44f769f9cc..c79e9a027aea4bca9102374efe497b0b4132c3f7 100644 (file)
@@ -84,7 +84,7 @@ namespace System.Runtime.Remoting.Contexts {
                public Context ()
                {
                        domain_id = Thread.GetDomainID();
-                       context_id = 1 + global_count++;
+                       context_id = Interlocked.Increment (ref global_count);
                }
 
                ~Context ()