comparison 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
comparison
equal deleted inserted replaced
10:e8375dd2bff3 11:12ec511a6415
183 183
184 void 184 void
185 VSs__init_Helper() 185 VSs__init_Helper()
186 { VSsSemEnv *semanticEnv; 186 { VSsSemEnv *semanticEnv;
187 int32 i, coreNum, slotNum; 187 int32 i, coreNum, slotNum;
188 VSsSemData *semData;
188 189
189 //Hook up the semantic layer's plug-ins to the Master virt procr 190 //Hook up the semantic layer's plug-ins to the Master virt procr
190 _VMSMasterEnv->requestHandler = &VSs__Request_Handler; 191 _VMSMasterEnv->requestHandler = &VSs__Request_Handler;
191 _VMSMasterEnv->slaveAssigner = &VSs__assign_slaveVP_to_slot; 192 _VMSMasterEnv->slaveAssigner = &VSs__assign_slaveVP_to_slot;
192 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS 193 #ifdef HOLISTIC__TURN_ON_PERF_COUNTERS
204 205
205 semanticEnv->shutdownInitiated = FALSE; 206 semanticEnv->shutdownInitiated = FALSE;
206 semanticEnv->coreIsDone = VMS_int__malloc( NUM_CORES * sizeof( bool32 ) ); 207 semanticEnv->coreIsDone = VMS_int__malloc( NUM_CORES * sizeof( bool32 ) );
207 //For each animation slot, there is an idle slave, and an initial 208 //For each animation slot, there is an idle slave, and an initial
208 // slave assigned as the current-task-slave. Create them here. 209 // slave assigned as the current-task-slave. Create them here.
209 SlaveVP *idleSlv, *currTaskSlv; 210 SlaveVP *idleSlv, *slotTaskSlv;
210 for( coreNum = 0; coreNum < NUM_CORES; coreNum++ ) 211 for( coreNum = 0; coreNum < NUM_CORES; coreNum++ )
211 { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown 212 { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown
212 213
213 for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum ) 214 for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum )
214 { idleSlv = VMS_int__create_slaveVP(&idle_fn,NULL); 215 { idleSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
215 idleSlv->coreAnimatedBy = coreNum; 216 idleSlv->coreAnimatedBy = coreNum;
216 idleSlv->animSlotAssignedTo = 217 idleSlv->animSlotAssignedTo =
217 _VMSMasterEnv->allAnimSlots[coreNum][slotNum]; 218 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
218 semanticEnv->idleSlv[coreNum][slotNum] = idleSlv; 219 semanticEnv->idleSlv[coreNum][slotNum] = idleSlv;
219 220
220 currTaskSlv = VMS_int__create_slaveVP( &idle_fn, NULL ); 221 slotTaskSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0);
221 currTaskSlv->coreAnimatedBy = coreNum; 222 slotTaskSlv->coreAnimatedBy = coreNum;
222 currTaskSlv->animSlotAssignedTo = 223 slotTaskSlv->animSlotAssignedTo =
223 _VMSMasterEnv->allAnimSlots[coreNum][slotNum]; 224 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
224 semanticEnv->currTaskSlvs[coreNum][slotNum] = currTaskSlv; 225
226 semData = slotTaskSlv->semanticData;
227 semData->needsTaskAssigned = TRUE;
228 semData->slaveType = SlotTaskSlv;
229 semanticEnv->slotTaskSlvs[coreNum][slotNum] = slotTaskSlv;
225 } 230 }
226 } 231 }
227 232
228 //create the ready queues, hash tables used for matching and so forth 233 //create the ready queues, hash tables used for matching and so forth
229 semanticEnv->slavesReadyToResumeQ = makeVMSQ(); 234 semanticEnv->slavesReadyToResumeQ = makeVMSQ();
417 VMS_WL__send_create_slaveVP_req( &reqData, creatingThd ); 422 VMS_WL__send_create_slaveVP_req( &reqData, creatingThd );
418 423
419 return creatingThd->dataRetFromReq; 424 return creatingThd->dataRetFromReq;
420 } 425 }
421 426
422 /*This is always the last thing done in the code animated by a thread. 427 /*This is always the last thing done in the code animated by a thread VP.
423 * Normally, this would be the last line of the thread's top level function. 428 * Normally, this would be the last line of the thread's top level function.
424 * But, if the thread exits from any point, it has to do so by calling 429 * But, if the thread exits from any point, it has to do so by calling
425 * this. 430 * this.
426 * 431 *
427 *This must update the count of active sub-tasks (sub-threads) of parents, 432 *It simply sends a dissipate request, which handles all the state cleanup.
428 * and the semantic data and task stub must stay.
429 */ 433 */
430 void 434 void
431 VSs__end_thread( SlaveVP *thdToEnd ) 435 VSs__end_thread( SlaveVP *thdToEnd )
432 { VSsSemData *semData; 436 { VSsSemData *semData;
433
434
435 //Update the count of live sub-tasks in parent. If parent was a
436 // thread and has already ended, then if this was the last sub-task,
437 // free the semantic data and task stub of the parent.
438 437
439 VMS_WL__send_dissipate_req( thdToEnd ); 438 VMS_WL__send_dissipate_req( thdToEnd );
440 } 439 }
440
441 441
442 442
443 //=========================================================================== 443 //===========================================================================
444 444
445 445