# HG changeset patch # User Merten Sach # Date 1316450714 -7200 # Node ID dd40181fd8bb5c6d9fc391f0ba23bb3033191503 # Parent 4977aea58ca0125888ef4308833c41d569cacf01 Shutdown via inter master request diff -r 4977aea58ca0 -r dd40181fd8bb VPThread_PluginFns.c --- a/VPThread_PluginFns.c Fri Sep 16 16:18:11 2011 +0200 +++ b/VPThread_PluginFns.c Mon Sep 19 18:45:14 2011 +0200 @@ -77,14 +77,18 @@ break; case createReq: handleCreate( req, requestingPr, semEnv); break; - case dissipate: handleDissipate( requestingPr, semEnv); - break; case VMSSemantic: VMS__handle_VMSSemReq(req, requestingPr, semEnv, (ResumePrFnPtr)&resume_procr); break; default: break; } + + if(req->reqType == dissipate) + {//handle the dissipate separately to avoid read after free + handleDissipate( requestingPr, semEnv); + break; + } req = VMS__take_next_request_out_of( requestingPr ); } //while( req != NULL ) diff -r 4977aea58ca0 -r dd40181fd8bb VPThread_lib.c --- a/VPThread_lib.c Fri Sep 16 16:18:11 2011 +0200 +++ b/VPThread_lib.c Mon Sep 19 18:45:14 2011 +0200 @@ -228,54 +228,7 @@ */ void VPThread__cleanup_after_shutdown() - { /*VPThdSemEnv *semEnv; - int32 coreIdx, idx, highestIdx; - VPThdMutex **mutexArray, *mutex; - VPThdCond **condArray, *cond; */ - - /* It's all allocated inside VMS's big chunk -- that's about to be freed, so - * nothing to do here - semEnv = _VMSMasterEnv->semanticEnv; - -//TODO: double check that all sem env locations freed - - for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) - { - free( semEnv->readyVPQs[coreIdx]->startOfData ); - free( semEnv->readyVPQs[coreIdx] ); - } - - free( semEnv->readyVPQs ); - - - //==== Free mutexes and mutex array ==== - mutexArray = semEnv->mutexDynArray->array; - highestIdx = semEnv->mutexDynArray->highestIdxInArray; - for( idx=0; idx < highestIdx; idx++ ) - { mutex = mutexArray[ idx ]; - if( mutex == NULL ) continue; - free( mutex ); - } - free( mutexArray ); - free( semEnv->mutexDynArray ); - //====================================== - - - //==== Free conds and cond array ==== - condArray = semEnv->condDynArray->array; - highestIdx = semEnv->condDynArray->highestIdxInArray; - for( idx=0; idx < highestIdx; idx++ ) - { cond = condArray[ idx ]; - if( cond == NULL ) continue; - free( cond ); - } - free( condArray ); - free( semEnv->condDynArray ); - //=================================== - - - free( _VMSMasterEnv->semanticEnv ); - */ + { VMS__cleanup_at_end_of_shutdown(); }