From 05d80be57cd54cf351b872d714beb71375e80882 Mon Sep 17 00:00:00 2001 From: jjenista Date: Tue, 26 Oct 2010 00:59:27 +0000 Subject: [PATCH] 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 --- Robust/src/IR/Flat/BuildCode.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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 -- 2.34.1