diff VSs.c @ 12:f56e3beac86b

wasn't a double free, some tasks have 0 args -> ptrEntries=NULL
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Mon, 20 Aug 2012 13:42:19 +0200
parents ed268fc7376a b13fbd445e0a
children 2bf83f932705
line diff
     1.1 --- a/VSs.c	Wed Aug 15 17:05:02 2012 +0200
     1.2 +++ b/VSs.c	Mon Aug 20 13:42:19 2012 +0200
     1.3 @@ -185,6 +185,7 @@
     1.4  VSs__init_Helper()
     1.5   { VSsSemEnv       *semanticEnv;
     1.6     int32            i, coreNum, slotNum;
     1.7 +   VSsSemData      *semData;
     1.8   
     1.9        //Hook up the semantic layer's plug-ins to the Master virt procr
    1.10     _VMSMasterEnv->requestHandler = &VSs__Request_Handler;
    1.11 @@ -206,22 +207,26 @@
    1.12     semanticEnv->coreIsDone = VMS_int__malloc( NUM_CORES * sizeof( bool32 ) );
    1.13        //For each animation slot, there is an idle slave, and an initial
    1.14        // slave assigned as the current-task-slave.  Create them here.
    1.15 -   SlaveVP *idleSlv, *currTaskSlv;
    1.16 +   SlaveVP *idleSlv, *slotTaskSlv;
    1.17     for( coreNum = 0; coreNum < NUM_CORES; coreNum++ )
    1.18      { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown
    1.19      
    1.20        for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum )
    1.21 -       { idleSlv = VMS_int__create_slaveVP(&idle_fn,NULL);
    1.22 +       { idleSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
    1.23           idleSlv->coreAnimatedBy                = coreNum;
    1.24           idleSlv->animSlotAssignedTo            =
    1.25                                 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
    1.26           semanticEnv->idleSlv[coreNum][slotNum] = idleSlv;
    1.27           
    1.28 -         currTaskSlv = VMS_int__create_slaveVP( &idle_fn, NULL );
    1.29 -         currTaskSlv->coreAnimatedBy                 = coreNum;
    1.30 -         currTaskSlv->animSlotAssignedTo             = 
    1.31 +         slotTaskSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
    1.32 +         slotTaskSlv->coreAnimatedBy            = coreNum;
    1.33 +         slotTaskSlv->animSlotAssignedTo        = 
    1.34                                 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
    1.35 -         semanticEnv->currTaskSlvs[coreNum][slotNum] = currTaskSlv;
    1.36 +         
    1.37 +         semData                    = slotTaskSlv->semanticData;
    1.38 +         semData->needsTaskAssigned = TRUE;
    1.39 +         semData->slaveType         = SlotTaskSlv;
    1.40 +         semanticEnv->slotTaskSlvs[coreNum][slotNum] = slotTaskSlv;
    1.41         }
    1.42      }
    1.43  
    1.44 @@ -419,27 +424,22 @@
    1.45     return creatingThd->dataRetFromReq;
    1.46   }
    1.47  
    1.48 -/*This is always the last thing done in the code animated by a thread.
    1.49 +/*This is always the last thing done in the code animated by a thread VP.
    1.50   * Normally, this would be the last line of the thread's top level function.
    1.51   * But, if the thread exits from any point, it has to do so by calling
    1.52   * this.
    1.53 - * 
    1.54 - *This must update the count of active sub-tasks (sub-threads) of parents,
    1.55 - * and the semantic data and task stub must stay.   
    1.56 + *
    1.57 + *It simply sends a dissipate request, which handles all the state cleanup.
    1.58   */
    1.59  void
    1.60  VSs__end_thread( SlaveVP *thdToEnd )
    1.61   { VSsSemData *semData;
    1.62 - 
    1.63 -   
    1.64 -      //Update the count of live sub-tasks in parent.  If parent was a
    1.65 -      // thread and has already ended, then if this was the last sub-task,
    1.66 -      // free the semantic data and task stub of the parent.
    1.67     
    1.68     VMS_WL__send_dissipate_req( thdToEnd );
    1.69   }
    1.70  
    1.71  
    1.72 +
    1.73  //===========================================================================
    1.74  
    1.75