Reset "inited" in the unsync mode so as to avoid expensive atomic operation by
authorChao Mei <chaomei2@illinois.edu>
Fri, 24 Feb 2012 02:28:53 +0000 (20:28 -0600)
committerChao Mei <chaomei2@illinois.edu>
Fri, 24 Feb 2012 02:28:53 +0000 (20:28 -0600)
helpers that are not able to do the work in time.

NodeHelper.C
NodeHelper.h

index 041cf75ab1377d26cb9d10fc84084a2226369d56..d328608ddce2c54529707faf6557a938399cd30b 100644 (file)
@@ -73,10 +73,8 @@ void FuncNodeHelper::parallelizeFunc(HelperFn func, int paramNum, void * param,
        curLoop->stealWork();
        TRACE_BRACKET(20);
        
-       if(!sync) return;
-
        TRACE_START(21);                
-       curLoop->waitLoopDone();
+       curLoop->waitLoopDone(sync);
        TRACE_BRACKET(21);        
 
     if (type!=NODEHELPER_NONE)
index de5c737889bcdfaa42c003e8f76257e3467cf7c5..14ca7c74ed1ac225dea740419eb93b90ea735e80 100644 (file)
@@ -67,9 +67,9 @@ public:
         inited = 1;
     }
       
-    void waitLoopDone(){
+    void waitLoopDone(int sync){
         //while(!__sync_bool_compare_and_swap(&finishFlag, numChunks, 0));
-       while(finishFlag!=numChunks);
+       if(sync) while(finishFlag!=numChunks);
        //finishFlag = 0;
         inited = 0;
     }