A better spin-waiting scheme. Using compare_and_set will cause bus-broadcast
authorChao Mei <chaomei2@illinois.edu>
Thu, 23 Feb 2012 07:05:53 +0000 (01:05 -0600)
committerChao Mei <chaomei2@illinois.edu>
Thu, 23 Feb 2012 07:05:53 +0000 (01:05 -0600)
each time.

NodeHelper.h

index 2e0ec510bae4ed6f047f5fcb85212bcea4579a83..08d18d36459219618ae3d5dcca253bc2d7d6de63 100644 (file)
@@ -60,7 +60,9 @@ public:
     }
       
     void waitLoopDone(){
-        while(!__sync_bool_compare_and_swap(&finishFlag, numChunks, 0));
+        //while(!__sync_bool_compare_and_swap(&finishFlag, numChunks, 0));
+       while(finishFlag!=numChunks);
+       finishFlag = 0;
         inited = 0;
     }
     int getNextChunkIdx(){