comparison VSs.c @ 38:a951b38d2cfc

remove need for end_thread()
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Fri, 17 May 2013 17:49:49 +0200
parents c8d4f6d3c7d3
children 0715109abb08
comparison
equal deleted inserted replaced
29:2a31d1f6f051 30:010f2f004282
83 83
84 semEnv = _VMSMasterEnv->semanticEnv; 84 semEnv = _VMSMasterEnv->semanticEnv;
85 85
86 //VSs starts with one processor, which is put into initial environ, 86 //VSs starts with one processor, which is put into initial environ,
87 // and which then calls create() to create more, thereby expanding work 87 // and which then calls create() to create more, thereby expanding work
88 seedSlv = VSs__create_slave_helper( fnPtr, initData, 88 seedSlv = VSs__create_slave_helper( &VSs__run_thread , fnPtr, initData, semEnv, semEnv->nextCoreToGetNewSlv++ );
89 semEnv, semEnv->nextCoreToGetNewSlv++ ); 89 //NB: this assumes that after VSs_init() nextCoreToGetNewSlv is still 0,
90 // and also that there is more than 1 core.
90 91
91 //seed slave is a thread slave, so make a thread's task stub for it 92 //seed slave is a thread slave, so make a thread's task stub for it
92 // and then make another to stand for the seed's parent task. Make 93 // and then make another to stand for the seed's parent task. Make
93 // the parent be already ended, and have one child (the seed). This 94 // the parent be already ended, and have one child (the seed). This
94 // will make the dissipate handler do the right thing when the seed 95 // will make the dissipate handler do the right thing when the seed
219 { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown 220 { semanticEnv->coreIsDone[coreNum] = FALSE; //use during shutdown
220 221
221 for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum ) 222 for( slotNum = 0; slotNum < NUM_ANIM_SLOTS; ++slotNum )
222 { 223 {
223 #ifdef IDLE_SLAVES 224 #ifdef IDLE_SLAVES
224 idleSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0); 225 idleSlv = VSs__create_slave_helper( &VSs__run_thread, &idle_fn, NULL, semanticEnv, 0);
225 idleSlv->coreAnimatedBy = coreNum; 226 idleSlv->coreAnimatedBy = coreNum;
226 idleSlv->animSlotAssignedTo = 227 idleSlv->animSlotAssignedTo =
227 _VMSMasterEnv->allAnimSlots[coreNum][slotNum]; 228 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
228 semanticEnv->idleSlv[coreNum][slotNum] = idleSlv; 229 semanticEnv->idleSlv[coreNum][slotNum] = idleSlv;
229 #endif 230 #endif
230 231
231 slotTaskSlv = VSs__create_slave_helper( &idle_fn, NULL, semanticEnv, 0); 232 slotTaskSlv = VSs__create_slave_helper(&VSs__run_thread, &idle_fn, NULL, semanticEnv, 0);
232 slotTaskSlv->coreAnimatedBy = coreNum; 233 slotTaskSlv->coreAnimatedBy = coreNum;
233 slotTaskSlv->animSlotAssignedTo = 234 slotTaskSlv->animSlotAssignedTo =
234 _VMSMasterEnv->allAnimSlots[coreNum][slotNum]; 235 _VMSMasterEnv->allAnimSlots[coreNum][slotNum];
235 236
236 semData = slotTaskSlv->semanticData; 237 semData = slotTaskSlv->semanticData;
491 { 492 {
492 493
493 VMS_WL__send_dissipate_req( currVP ); 494 VMS_WL__send_dissipate_req( currVP );
494 } 495 }
495 496
496 497 void VSs__run_thread(TopLevelFnPtr fnPtr, void *initData){
498 (*fnPtr)(initData);
499 VSs__end_thread();
500 }
497 501
498 //=========================================================================== 502 //===========================================================================
499 503
500 504
501 //======================= task submit and end ============================== 505 //======================= task submit and end ==============================
565 reqData.callingSlv = currVP; 569 reqData.callingSlv = currVP;
566 570
567 VMS_WL__send_sem_request( &reqData, currVP ); 571 VMS_WL__send_sem_request( &reqData, currVP );
568 } 572 }
569 573
570 void plugin__end_VP(){ 574 void VSs__run_task(TopLevelFnPtr fnPtr, void *initData){
571 VSs__end_task();} 575 (*fnPtr)(initData);
576 VSs__end_task();
577 }
572 578
573 void 579 void
574 VSs__taskwait() 580 VSs__taskwait()
575 { 581 {
576 VSsSemReq reqData; 582 VSsSemReq reqData;
944 int __main_ret; 950 int __main_ret;
945 951
946 void __entry_point(void* _args) { 952 void __entry_point(void* _args) {
947 __main_args* args = (__main_args*) _args; 953 __main_args* args = (__main_args*) _args;
948 __main_ret = __program_main(args->argc, args->argv); 954 __main_ret = __program_main(args->argc, args->argv);
949 VSs__end_thread();
950 } 955 }
951 956
952 #undef main 957 #undef main
953 958
954 int main(int argc, char** argv) { 959 int main(int argc, char** argv) {