diff VMS.c @ 135:0b49fd35afc1

distributed free working -app sends a VMSSemReqst to his Master which send a request to a different Master -Master send the request directly -The request structure is freed by the sender, when the request was handled There are still problems on shutdown. The shutdownVPs are all allocated by one Master which is likly to be terminated
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 16 Sep 2011 20:08:28 +0200
parents a9b72021f053
children f1374d5dbb98
line diff
     1.1 --- a/VMS.c	Fri Sep 16 16:19:24 2011 +0200
     1.2 +++ b/VMS.c	Fri Sep 16 20:08:28 2011 +0200
     1.3 @@ -111,6 +111,7 @@
     1.4     {
     1.5         _VMSMasterEnv->freeListHead[i]        = VMS_ext__create_free_list();
     1.6         _VMSMasterEnv->interMasterRequestsFor[i] = NULL;
     1.7 +       _VMSMasterEnv->interMasterRequestsSentBy[i] = NULL;
     1.8     }
     1.9     _VMSMasterEnv->currentMasterProcrID = 0;
    1.10  
    1.11 @@ -562,18 +563,27 @@
    1.12  
    1.13     semReq = req->semReqData;
    1.14  
    1.15 -   newProbe          = VMS__malloc( sizeof(IntervalProbe) );
    1.16 -   newProbe->nameStr = VMS__strDup( semReq->nameStr );
    1.17 -   newProbe->hist    = NULL;
    1.18 -   newProbe->schedChoiceWasRecorded = FALSE;
    1.19 +   switch(semReq->reqType){
    1.20 +       case createProbe:
    1.21 +           newProbe          = VMS__malloc( sizeof(IntervalProbe) );
    1.22 +           newProbe->nameStr = VMS__strDup( (char*)semReq->data );
    1.23 +           newProbe->hist    = NULL;
    1.24 +           newProbe->schedChoiceWasRecorded = FALSE;
    1.25  
    1.26 -      //This runs in masterVP, so no race-condition worries
    1.27 -   newProbe->probeID =
    1.28 -             addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo );
    1.29 -
    1.30 -   requestingPr->dataRetFromReq = newProbe;
    1.31 -
    1.32 -   (*resumePrFnPtr)( requestingPr, semEnv );
    1.33 +           //This runs in masterVP, so no race-condition worries
    1.34 +           newProbe->probeID =
    1.35 +                   addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo );
    1.36 +           requestingPr->dataRetFromReq = newProbe;
    1.37 +           break;
    1.38 +       case interMasterReqst:
    1.39 +           sendInterMasterReqst(semReq->receiverID,
    1.40 +                   (InterMasterReqst*)semReq->data);
    1.41 +           break;
    1.42 +       default:
    1.43 +           break;       
    1.44 +   }
    1.45 +   
    1.46 +   resumePrFnPtr( requestingPr, semEnv );
    1.47   }
    1.48  
    1.49  
    1.50 @@ -609,8 +619,13 @@
    1.51        // itself
    1.52        //Note, should not stack-allocate initial data -- no guarantee, in
    1.53        // general that creating processor will outlive ones it creates.
    1.54 -   VMS__free( animatingPr->startOfStack );
    1.55 -   VMS__free( animatingPr );
    1.56 +    
    1.57 +    
    1.58 +   /*
    1.59 +    * call the core specific version, because the creating master can already be dead
    1.60 +    */   
    1.61 +   //VMS__free_in_lib( animatingPr->startOfStack, animatingPr );
    1.62 +   //VMS__free_in_lib( animatingPr, animatingPr);
    1.63   }
    1.64  
    1.65  
    1.66 @@ -771,7 +786,9 @@
    1.67     //========================================================================
    1.68  */
    1.69        //These are the only two that use system free 
    1.70 -   VMS_ext__free_free_list( _VMSMasterEnv->freeListHead);
    1.71 +   int i;
    1.72 +   for(i=0; i<NUM_CORES; i++)
    1.73 +        VMS_ext__free_free_list( _VMSMasterEnv->freeListHead[i]);
    1.74     free( (void *)_VMSMasterEnv );
    1.75   }
    1.76