changeset 20:dd40181fd8bb DistibutedMalloc

Shutdown via inter master request
author Merten Sach <msach@mailbox.tu-berlin.de>
date Mon, 19 Sep 2011 18:45:14 +0200
parents 4977aea58ca0
children 2d2d942afbaf
files VPThread_PluginFns.c VPThread_lib.c
diffstat 2 files changed, 7 insertions(+), 50 deletions(-) [+]
line diff
     1.1 --- a/VPThread_PluginFns.c	Fri Sep 16 16:18:11 2011 +0200
     1.2 +++ b/VPThread_PluginFns.c	Mon Sep 19 18:45:14 2011 +0200
     1.3 @@ -77,14 +77,18 @@
     1.4              break;
     1.5           case createReq:    handleCreate(         req, requestingPr, semEnv);
     1.6              break;
     1.7 -         case dissipate:    handleDissipate(           requestingPr, semEnv);
     1.8 -            break;
     1.9           case VMSSemantic:  VMS__handle_VMSSemReq(req, requestingPr, semEnv,
    1.10                                                  (ResumePrFnPtr)&resume_procr);
    1.11              break;
    1.12           default:
    1.13              break;
    1.14         }
    1.15 +      
    1.16 +      if(req->reqType == dissipate)
    1.17 +      {//handle the dissipate separately to avoid read after free          
    1.18 +          handleDissipate(           requestingPr, semEnv);
    1.19 +          break;
    1.20 +      }          
    1.21  
    1.22        req = VMS__take_next_request_out_of( requestingPr );
    1.23      } //while( req != NULL )
     2.1 --- a/VPThread_lib.c	Fri Sep 16 16:18:11 2011 +0200
     2.2 +++ b/VPThread_lib.c	Mon Sep 19 18:45:14 2011 +0200
     2.3 @@ -228,54 +228,7 @@
     2.4   */
     2.5  void
     2.6  VPThread__cleanup_after_shutdown()
     2.7 - { /*VPThdSemEnv *semEnv;
     2.8 -   int32           coreIdx,     idx,   highestIdx;
     2.9 -   VPThdMutex      **mutexArray, *mutex;
    2.10 -   VPThdCond       **condArray, *cond; */
    2.11 - 
    2.12 - /* It's all allocated inside VMS's big chunk -- that's about to be freed, so
    2.13 - *  nothing to do here
    2.14 -  semEnv = _VMSMasterEnv->semanticEnv;
    2.15 -
    2.16 -//TODO: double check that all sem env locations freed
    2.17 -
    2.18 -   for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
    2.19 -    {
    2.20 -      free( semEnv->readyVPQs[coreIdx]->startOfData );
    2.21 -      free( semEnv->readyVPQs[coreIdx] );
    2.22 -    }
    2.23 -   
    2.24 -   free( semEnv->readyVPQs );
    2.25 -
    2.26 -   
    2.27 -   //==== Free mutexes and mutex array ====
    2.28 -   mutexArray = semEnv->mutexDynArray->array;
    2.29 -   highestIdx = semEnv->mutexDynArray->highestIdxInArray;
    2.30 -   for( idx=0; idx < highestIdx; idx++ )
    2.31 -    { mutex = mutexArray[ idx ];
    2.32 -      if( mutex == NULL ) continue;
    2.33 -      free( mutex );
    2.34 -    }
    2.35 -   free( mutexArray );
    2.36 -   free( semEnv->mutexDynArray );
    2.37 -   //======================================
    2.38 -   
    2.39 -
    2.40 -   //==== Free conds and cond array ====
    2.41 -   condArray  = semEnv->condDynArray->array;
    2.42 -   highestIdx = semEnv->condDynArray->highestIdxInArray;
    2.43 -   for( idx=0; idx < highestIdx; idx++ )
    2.44 -    { cond = condArray[ idx ];
    2.45 -      if( cond == NULL ) continue;
    2.46 -      free( cond );
    2.47 -    }
    2.48 -   free( condArray );
    2.49 -   free( semEnv->condDynArray );
    2.50 -   //===================================
    2.51 -
    2.52 -   
    2.53 -   free( _VMSMasterEnv->semanticEnv );
    2.54 -  */
    2.55 + {
    2.56     VMS__cleanup_at_end_of_shutdown();
    2.57   }
    2.58