From: jjenista Date: Tue, 26 Oct 2010 00:59:27 +0000 (+0000) Subject: fixed nasty bug, decrementing parents num running children used to be last, but new... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=05d80be57cd54cf351b872d714beb71375e80882;p=IRC.git fixed nasty bug, decrementing parents num running children used to be last, but new code has creeped up afte rit, move this down to the very last thing done before exiting --- diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index f5816ca6..5573f761 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -4615,15 +4615,6 @@ public class BuildCode { } - // last of all, decrement your parent's number of running children - output.println(" if( runningSESE->parent != NULL ) {"); - output.println(" if( atomic_sub_and_test( 1, &(runningSESE->parent->numRunningChildren) ) ) {"); - output.println(" pthread_mutex_lock ( &(runningSESE->parent->lock) );"); - output.println(" pthread_cond_signal ( &(runningSESE->parent->runningChildrenCond) );"); - output.println(" pthread_mutex_unlock( &(runningSESE->parent->lock) );"); - output.println(" }"); - output.println(" }"); - // a task has variables to track static/dynamic instances // that serve as sources, release the parent's ref of each // non-null var of these types @@ -4664,6 +4655,17 @@ public class BuildCode { // the main task has no parent, just free its record output.println(" mlpFreeSESErecord( runningSESE );"); } + + + // last of all, decrement your parent's number of running children + output.println(" if( runningSESE->parent != NULL ) {"); + output.println(" if( atomic_sub_and_test( 1, &(runningSESE->parent->numRunningChildren) ) ) {"); + output.println(" pthread_mutex_lock ( &(runningSESE->parent->lock) );"); + output.println(" pthread_cond_signal ( &(runningSESE->parent->runningChildrenCond) );"); + output.println(" pthread_mutex_unlock( &(runningSESE->parent->lock) );"); + output.println(" }"); + output.println(" }"); + // as this thread is wrapping up the task, make sure the thread-local var // for the currently running task record references an invalid task