diff Implab/Parallels/MTQueue.cs @ 80:4f20870d0816 v2

added memory barriers
author cin
date Fri, 26 Sep 2014 03:32:34 +0400
parents 1714fd8678ef
children dc4942d09e74
line wrap: on
line diff
--- a/Implab/Parallels/MTQueue.cs	Mon Sep 22 18:20:49 2014 +0400
+++ b/Implab/Parallels/MTQueue.cs	Fri Sep 26 03:32:34 2014 +0400
@@ -18,6 +18,8 @@
         Node m_last;
 
         public void Enqueue(T value) {
+            Thread.MemoryBarrier();
+
             var last = m_last;
             var next = new Node(value);
 
@@ -35,6 +37,7 @@
             Node next = null;
             value = default(T);
 
+            Thread.MemoryBarrier();
             do {
                 first = m_first;
                 if (first == null)