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

added memory barriers
author cin
date Fri, 26 Sep 2014 03:32:34 +0400
parents c761fc982e1d
children daffa72a1cec
comparison
equal deleted inserted replaced
79:05e6468f066f 80:4f20870d0816
140 throw new InvalidOperationException("Can't complete transition when the object isn't in the transitional state"); 140 throw new InvalidOperationException("Can't complete transition when the object isn't in the transitional state");
141 } 141 }
142 142
143 void WaitTransition() { 143 void WaitTransition() {
144 while (m_state == TRANSITIONAL_STATE) { 144 while (m_state == TRANSITIONAL_STATE) {
145 /* noop */ 145 Thread.MemoryBarrier();
146 } 146 }
147 } 147 }
148 148
149 public bool IsResolved { 149 public bool IsResolved {
150 get { 150 get {
151 Thread.MemoryBarrier();
151 return m_state > 1; 152 return m_state > 1;
152 } 153 }
153 } 154 }
154 155
155 public bool IsCancelled { 156 public bool IsCancelled {
156 get { 157 get {
158 Thread.MemoryBarrier();
157 return m_state == CANCELLED_STATE; 159 return m_state == CANCELLED_STATE;
158 } 160 }
159 } 161 }
160 162
161 public Type PromiseType { 163 public Type PromiseType {