diff Implab/Promise.cs @ 80:4f20870d0816 v2

added memory barriers
author cin
date Fri, 26 Sep 2014 03:32:34 +0400
parents c761fc982e1d
children daffa72a1cec
line wrap: on
line diff
--- a/Implab/Promise.cs	Mon Sep 22 18:20:49 2014 +0400
+++ b/Implab/Promise.cs	Fri Sep 26 03:32:34 2014 +0400
@@ -142,18 +142,20 @@
 
         void WaitTransition() {
             while (m_state == TRANSITIONAL_STATE) {
-                /* noop */
+                Thread.MemoryBarrier();
             }
         }
 
         public bool IsResolved {
             get {
+                Thread.MemoryBarrier();
                 return m_state > 1;
             }
         }
 
         public bool IsCancelled {
             get {
+                Thread.MemoryBarrier();
                 return m_state == CANCELLED_STATE;
             }
         }