diff MasterLoop.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 99343ffe1918
line diff
     1.1 --- a/MasterLoop.c	Fri Sep 16 16:19:24 2011 +0200
     1.2 +++ b/MasterLoop.c	Fri Sep 16 20:08:28 2011 +0200
     1.3 @@ -12,7 +12,8 @@
     1.4  #include "VMS.h"
     1.5  #include "ProcrContext.h"
     1.6  #include "scheduling.h"
     1.7 -#include "inter_VMS_request_handlers.h"
     1.8 +#include "inter_VMS_requests.h"
     1.9 +#include "inter_VMS_requests_handler.h"
    1.10  
    1.11  //===========================================================================
    1.12  void inline
    1.13 @@ -127,12 +128,23 @@
    1.14     semanticEnv      = masterEnv->semanticEnv;
    1.15  
    1.16        //First, check for requests from other MasterVPs, and handle them
    1.17 -   InterMasterReqst* currReq = masterEnv->interMasterRequestsFor[thisCoresIdx];
    1.18 -   while(currReq)
    1.19 +   InterMasterReqst* currReqst = masterEnv->interMasterRequestsFor[thisCoresIdx];
    1.20 +   while(currReqst)
    1.21     {
    1.22 -       handleInterMasterReq( currReq, semanticEnv, masterPr );
    1.23 -       currReq = currReq->nextReqst;
    1.24 +       handleInterMasterReq( currReqst, semanticEnv, masterPr );
    1.25 +       currReqst = currReqst->nextReqst;
    1.26     }
    1.27 +   masterEnv->interMasterRequestsFor[thisCoresIdx] = NULL;
    1.28 +   
    1.29 +   //Second, check for own request that were handled for other MasterVPs
    1.30 +   currReqst = masterEnv->interMasterRequestsSentBy[thisCoresIdx];
    1.31 +   while(currReqst && currReqst->obsolete)
    1.32 +   {
    1.33 +       InterMasterReqst *nextReqst = currReqst->nextSentReqst;
    1.34 +       VMS__free(currReqst);
    1.35 +       currReqst = nextReqst;
    1.36 +   }
    1.37 +   masterEnv->interMasterRequestsSentBy[thisCoresIdx] = currReqst;
    1.38     
    1.39        //Now, take care of the SlaveVPs
    1.40        //Go through the slots -- if Slave there newly suspended, handle its request
    1.41 @@ -228,8 +240,10 @@
    1.42   { 
    1.43     switch( currReq->reqType )
    1.44      {
    1.45 -      case transfer_free_ptr:    handleTransferFree( currReq, masterPr );
    1.46 -         break;
    1.47 +      case transfer_free_ptr:
    1.48 +          handleTransferFree( currReq, masterPr );
    1.49 +          currReq->obsolete = 1; //now the sender can free the structure
    1.50 +          break;
    1.51        default:
    1.52            break;
    1.53      }