diff Implab/Parallels/MTQueue.cs @ 19:e3935fdf59a2 promises

Promise is rewritten to use interlocked operations instead of locks
author cin
date Sun, 10 Nov 2013 00:21:33 +0400
parents e943453e5039
children ee04e1fa78da
line wrap: on
line diff
--- a/Implab/Parallels/MTQueue.cs	Fri Nov 08 01:25:42 2013 +0400
+++ b/Implab/Parallels/MTQueue.cs	Sun Nov 10 00:21:33 2013 +0400
@@ -42,12 +42,13 @@
                 next = first.next;
                 if (next == null) {
                     // this is the last element,
-                    // then try to update tail
+                    // then try to update the tail
                     if (first != Interlocked.CompareExchange(ref m_last, null, first)) {
-                        // this is inconsistent situation which means that the queue is empty
+                        // this is a ace condition
                         if (m_last == null)
+                            // the queue is empty
                             return false;
-                        // tail has been changed, that means that we need to restart
+                        // tail has been changed, than we need to restart
                         continue; 
                     }