Replaced Volatile.Write() with the volatile modifier
authorPetr Onderka <gsvick@gmail.com>
Fri, 6 Jul 2012 15:53:38 +0000 (17:53 +0200)
committerPetr Onderka <gsvick@gmail.com>
Sun, 19 Aug 2012 21:44:04 +0000 (23:44 +0200)
Mono doesn't support the generic version of Volatile.Write()

mcs/class/System.Threading.Tasks.Dataflow/System.Threading.Tasks.Dataflow/MessageOutgoingQueue.cs

index 435a5dd860058365b3fe08d3013176ce5b1e3e88..3f222d89e8bef224a730d7d450d3c2002253cab9 100644 (file)
@@ -40,7 +40,7 @@ namespace System.Threading.Tasks.Dataflow {
                readonly AtomicBoolean isProcessing = new AtomicBoolean ();
                readonly TargetCollection<T> targets;
                SpinLock firstItemLock = new SpinLock();
-               ITargetBlock<T> reservedForTargetBlock;
+               volatile ITargetBlock<T> reservedForTargetBlock;
 
                public MessageOutgoingQueue (
                        ISourceBlock<T> block, CompletionHelper compHelper,
@@ -183,7 +183,7 @@ namespace System.Threading.Tasks.Dataflow {
                                        throw new InvalidOperationException(
                                                "The target did not have the message reserved.");
 
-                               Volatile.Write(ref reservedForTargetBlock, null);
+                               reservedForTargetBlock = null;
                        } finally {
                                if (lockTaken)
                                        firstItemLock.Exit ();