Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VSs_impls > VSs__MC_shared_impl
comparison VSs.c @ 7:3999b8429ddd
Not working -- check point to share changes with Nina
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Wed, 01 Aug 2012 03:16:27 -0700 |
| parents | 1780f6b00e3d |
| children | eb3d77ca9f59 |
comparison
equal
deleted
inserted
replaced
| 5:f772dad3b39e | 6:fb263b95cd61 |
|---|---|
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 //=========================================================================== | 392 //=========================================================================== |
| 393 | 393 |
| 394 /* | |
| 395 */ | |
| 396 SlaveVP * | 394 SlaveVP * |
| 397 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData, | 395 VSs__create_thread( TopLevelFnPtr fnPtr, void *initData, |
| 398 SlaveVP *creatingSlv ) | 396 SlaveVP *creatingThd ) |
| 399 { VSsSemReq reqData; | 397 { VSsSemReq reqData; |
| 400 | 398 |
| 401 //the semantic request data is on the stack and disappears when this | 399 //the semantic request data is on the stack and disappears when this |
| 402 // call returns -- it's guaranteed to remain in the VP's stack for as | 400 // call returns -- it's guaranteed to remain in the VP's stack for as |
| 403 // long as the VP is suspended. | 401 // long as the VP is suspended. |
| 404 reqData.reqType = 0; //know type because in a VMS create req | 402 reqData.reqType = 0; //know type because in a VMS create req |
| 405 reqData.coreToAssignOnto = -1; //means round-robin assign | |
| 406 reqData.fnPtr = fnPtr; | 403 reqData.fnPtr = fnPtr; |
| 407 reqData.initData = initData; | 404 reqData.initData = initData; |
| 408 reqData.callingSlv = creatingSlv; | 405 reqData.callingSlv = creatingThd; |
| 409 | 406 |
| 410 VMS_WL__send_create_slaveVP_req( &reqData, creatingSlv ); | 407 VMS_WL__send_create_slaveVP_req( &reqData, creatingThd ); |
| 411 | 408 |
| 412 return creatingSlv->dataRetFromReq; | 409 return creatingThd->dataRetFromReq; |
| 413 } | 410 } |
| 414 | 411 |
| 415 SlaveVP * | 412 /*This is always the last thing done in the code animated by a thread. |
| 416 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData, | 413 * Normally, this would be the last line of the thread's top level function. |
| 417 SlaveVP *creatingSlv, int32 coreToAssignOnto ) | 414 * But, if the thread exits from any point, it has to do so by calling |
| 418 { VSsSemReq reqData; | 415 * this. |
| 419 | 416 * |
| 420 //the semantic request data is on the stack and disappears when this | 417 *This must update the count of active sub-tasks (sub-threads) of parents, |
| 421 // call returns -- it's guaranteed to remain in the VP's stack for as | 418 * and the semantic data and task stub must stay |
| 422 // long as the VP is suspended. | 419 */ |
| 423 reqData.reqType = create_slave_w_aff; //not used, May 2012 | 420 void |
| 424 reqData.coreToAssignOnto = coreToAssignOnto; | 421 VSs__end_thread( SlaveVP *thdToEnd ) |
| 425 reqData.fnPtr = fnPtr; | 422 { |
| 426 reqData.initData = initData; | 423 //check whether all sub-tasks have ended.. if not, don't free the |
| 427 reqData.callingSlv = creatingSlv; | 424 // semantic data nor task stub of this thread. |
| 428 | 425 check_sub_tasks(); |
| 429 VMS_WL__send_create_slaveVP_req( &reqData, creatingSlv ); | 426 |
| 430 | 427 //Update the count of live sub-tasks in parent. If parent was a |
| 431 return creatingSlv->dataRetFromReq; | 428 // thread and has already ended, then if this was the last sub-task, |
| 432 } | 429 // free the semantic data and task stub of the parent. |
| 433 | 430 VMS_WL__send_dissipate_req( thdToEnd ); |
| 434 | |
| 435 void | |
| 436 VSs__dissipate_slave( SlaveVP *slaveToDissipate ) | |
| 437 { | |
| 438 VMS_WL__send_dissipate_req( slaveToDissipate ); | |
| 439 } | 431 } |
| 440 | 432 |
| 441 | 433 |
| 442 //=========================================================================== | 434 //=========================================================================== |
| 443 | 435 |
| 807 reqData.reqType = trans_end; | 799 reqData.reqType = trans_end; |
| 808 reqData.transID = transactionID; | 800 reqData.transID = transactionID; |
| 809 | 801 |
| 810 VMS_WL__send_sem_request( &reqData, animSlv ); | 802 VMS_WL__send_sem_request( &reqData, animSlv ); |
| 811 } | 803 } |
| 804 | |
| 805 //======================== Internal ================================== | |
| 806 /* | |
| 807 */ | |
| 808 SlaveVP * | |
| 809 VSs__create_slave_with( TopLevelFnPtr fnPtr, void *initData, | |
| 810 SlaveVP *creatingSlv ) | |
| 811 { VSsSemReq reqData; | |
| 812 | |
| 813 //the semantic request data is on the stack and disappears when this | |
| 814 // call returns -- it's guaranteed to remain in the VP's stack for as | |
| 815 // long as the VP is suspended. | |
| 816 reqData.reqType = 0; //know type because in a VMS create req | |
| 817 reqData.coreToAssignOnto = -1; //means round-robin assign | |
| 818 reqData.fnPtr = fnPtr; | |
| 819 reqData.initData = initData; | |
| 820 reqData.callingSlv = creatingSlv; | |
| 821 | |
| 822 VMS_WL__send_create_slaveVP_req( &reqData, creatingSlv ); | |
| 823 | |
| 824 return creatingSlv->dataRetFromReq; | |
| 825 } | |
| 826 | |
| 827 SlaveVP * | |
| 828 VSs__create_slave_with_affinity( TopLevelFnPtr fnPtr, void *initData, | |
| 829 SlaveVP *creatingSlv, int32 coreToAssignOnto ) | |
| 830 { VSsSemReq reqData; | |
| 831 | |
| 832 //the semantic request data is on the stack and disappears when this | |
| 833 // call returns -- it's guaranteed to remain in the VP's stack for as | |
| 834 // long as the VP is suspended. | |
| 835 reqData.reqType = create_slave_w_aff; //not used, May 2012 | |
| 836 reqData.coreToAssignOnto = coreToAssignOnto; | |
| 837 reqData.fnPtr = fnPtr; | |
| 838 reqData.initData = initData; | |
| 839 reqData.callingSlv = creatingSlv; | |
| 840 | |
| 841 VMS_WL__send_create_slaveVP_req( &reqData, creatingSlv ); | |
| 842 | |
| 843 return creatingSlv->dataRetFromReq; | |
| 844 } | |
| 845 |
