diff Implab/Parallels/MTQueue.cs @ 93:dc4942d09e74 v2

improved tracing added the application components container MTComponentContainer.AppContainer
author cin
date Thu, 23 Oct 2014 01:13:57 +0400
parents 4f20870d0816
children b11c7e9d93bc
line wrap: on
line diff
--- a/Implab/Parallels/MTQueue.cs	Wed Oct 22 18:37:56 2014 +0400
+++ b/Implab/Parallels/MTQueue.cs	Thu Oct 23 01:13:57 2014 +0400
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
+using System.Threading;
 
 namespace Implab.Parallels {
     public class MTQueue<T> {
@@ -34,7 +30,7 @@
 
         public bool TryDequeue(out T value) {
             Node first;
-            Node next = null;
+            Node next;
             value = default(T);
 
             Thread.MemoryBarrier();
@@ -64,11 +60,10 @@
                     Interlocked.CompareExchange(ref m_first, null, first);
                     break;
 
-                } else {
-                    if (first == Interlocked.CompareExchange(ref m_first, next, first))
-                        // head succesfully updated
-                        break;
                 }
+                if (first == Interlocked.CompareExchange(ref m_first, next, first))
+                    // head succesfully updated
+                    break;
             } while (true);
 
             value = first.value;