Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
changeset 3:9f2e23d38ff2
Works Sequentially -- first debugged version fully working
author | Me |
---|---|
date | Wed, 28 Jul 2010 13:16:09 -0700 |
parents | f6b960f40005 |
children | b7a974ccc6f4 |
files | VMSHW.h VMSHW_PluginFns.c VMSHW_Request_Handlers.c VMSHW_lib.c |
diffstat | 4 files changed, 34 insertions(+), 17 deletions(-) [+] |
line diff
1.1 --- a/VMSHW.h Mon Jul 26 15:26:57 2010 -0700 1.2 +++ b/VMSHW.h Wed Jul 28 13:16:09 2010 -0700 1.3 @@ -62,7 +62,7 @@ 1.4 VMSHW__init(); 1.5 1.6 void 1.7 -VMSHW__shutdown(); 1.8 +VMSHW__cleanup_after_shutdown(); 1.9 1.10 //======================= 1.11
2.1 --- a/VMSHW_PluginFns.c Mon Jul 26 15:26:57 2010 -0700 2.2 +++ b/VMSHW_PluginFns.c Wed Jul 28 13:16:09 2010 -0700 2.3 @@ -71,14 +71,13 @@ 2.4 { 2.5 //free any semantic data allocated to the virt procr 2.6 2.7 - //Now, call VMS's dissipate fn, which will free stack and rest 2.8 - VMS__dissipate_procr( requestingPr ); 2.9 + //Now, call VMS to free_all AppVP state -- stack and so on 2.10 + VMS__handle_dissipate_reqst( requestingPr ); 2.11 2.12 semEnv->numVirtPr -= 1; 2.13 if( semEnv->numVirtPr == 0 ) 2.14 - { //no more work, so shutdown -- create shutdown procr & Q it 2.15 - VirtProcr * shutdownPr = VMS__create_the_shutdown_procr(); 2.16 - writePrivQ( shutdownPr, semEnv->readyVirtProcrQ ); 2.17 + { //no more work, so shutdown 2.18 + VMS__handle_shutdown_reqst( requestingPr ); 2.19 } 2.20 } 2.21
3.1 --- a/VMSHW_Request_Handlers.c Mon Jul 26 15:26:57 2010 -0700 3.2 +++ b/VMSHW_Request_Handlers.c Wed Jul 28 13:16:09 2010 -0700 3.3 @@ -95,6 +95,8 @@ 3.4 { //waiting request is another send, so stack this up on list 3.5 semReq-> nextReqInHashEntry = waitingReq->nextReqInHashEntry; 3.6 waitingReq->nextReqInHashEntry = semReq; 3.7 + printf("linked requests: %d, %d | ", semReq, waitingReq ); 3.8 + printf("type: %d, %d\n", semReq->reqType, waitingReq->reqType ); 3.9 return; 3.10 } 3.11 else 3.12 @@ -151,11 +153,16 @@ 3.13 { printf("\n ERROR: shouldn't be two send from-tos waiting \n"); 3.14 } 3.15 else 3.16 - { //waiting request is a receive, so pair it to this send 3.17 - //first, remove the waiting receive request from the list in entry 3.18 + { //waiting request is a receive, so it completes pair with this send 3.19 + 3.20 + //remove the waiting receive request from the entry 3.21 entry->content = waitingReq->nextReqInHashEntry; 3.22 //can only be one waiting req for "from-to" semantics 3.23 - if( entry->content != NULL ) printf("\nERROR in handleSendFromTo\n"); 3.24 + if( entry->content != NULL ) 3.25 + { 3.26 + printf("\nERROR in handleSendFromTo\n"); 3.27 + printf("waitReq: %d | next req: %d\n", waitingReq, entry->content); 3.28 + } 3.29 deleteEntryFromTable( entry->key, commHashTbl ); //frees entry too 3.30 3.31 //attach msg that's in this send request to receiving procr
4.1 --- a/VMSHW_lib.c Mon Jul 26 15:26:57 2010 -0700 4.2 +++ b/VMSHW_lib.c Wed Jul 28 13:16:09 2010 -0700 4.3 @@ -14,6 +14,12 @@ 4.4 #include "VMS/Hash_impl/PrivateHash.h" 4.5 4.6 4.7 +//========================================================================== 4.8 + 4.9 +void 4.10 +VMSHW__init_Seq(); 4.11 +//========================================================================== 4.12 + 4.13 4.14 /*TODO: Q: dealing with library f()s and DKU vs WT vs FoR 4.15 * (still want to do FoR, with time-lines as syntax, could be super cool) 4.16 @@ -92,14 +98,13 @@ 4.17 4.18 //NOTE: no Threads should exist in the outside program that might touch 4.19 // any of the data reachable from initData given to the seed procr 4.20 - VMS__start_the_work_then_wait_until_done(); 4.21 +// VMS__start_the_work_then_wait_until_done(); 4.22 + VMS__start_the_work_then_wait_until_done_Seq(); 4.23 4.24 - VMSHW__shutdown(); 4.25 + VMSHW__cleanup_after_shutdown(); 4.26 } 4.27 4.28 4.29 - 4.30 - 4.31 //=========================================================================== 4.32 4.33 /*Initializes all the data-structures for a VMSHW system -- but doesn't 4.34 @@ -115,7 +120,8 @@ 4.35 VMSHW__init() 4.36 { VMSHWSemEnv *semanticEnv; 4.37 4.38 - VMS__init(); 4.39 +// VMS__init(); 4.40 + VMS__init_Seq(); 4.41 //masterEnv, a global var, now is partially set up by init_VMS 4.42 4.43 //Hook up the semantic layer's plug-ins to the Master virt procr 4.44 @@ -135,20 +141,21 @@ 4.45 semanticEnv->commHashTbl = makeHashTable( 1<<16, NULL ); //start big 4.46 } 4.47 4.48 + 4.49 /*Frees any memory allocated by VMSHW__init() then calls VMS__shutdown 4.50 */ 4.51 void 4.52 -VMSHW__shutdown() 4.53 +VMSHW__cleanup_after_shutdown() 4.54 { VMSHWSemEnv *semanticEnv; 4.55 4.56 semanticEnv = _VMSMasterEnv->semanticEnv; 4.57 4.58 - //TODO: double check all sem env locations freed 4.59 +//TODO: double check all sem env locations freed 4.60 free( semanticEnv->readyVirtProcrQ->startOfData ); 4.61 free( semanticEnv->readyVirtProcrQ ); 4.62 freeHashTable( semanticEnv->commHashTbl ); 4.63 free( _VMSMasterEnv->semanticEnv ); 4.64 - VMS__shutdown(); 4.65 + VMS__cleanup_after_shutdown(); 4.66 } 4.67 4.68 4.69 @@ -250,6 +257,7 @@ 4.70 reqData->reqType = send_type; 4.71 reqData->msgType = type; 4.72 reqData->msg = msg; 4.73 + reqData->nextReqInHashEntry = NULL; 4.74 4.75 //On ownership -- remove inside the send and let ownership sit in limbo 4.76 // as a potential in an entry in the hash table, when this receive msg 4.77 @@ -274,6 +282,7 @@ 4.78 reqData->sendPr = sendPr; 4.79 reqData->reqType = send_from_to; 4.80 reqData->msg = msg; 4.81 + reqData->nextReqInHashEntry = NULL; 4.82 4.83 //On ownership -- remove inside the send and let ownership sit in limbo 4.84 // as a potential in an entry in the hash table, when this receive msg 4.85 @@ -304,6 +313,7 @@ 4.86 reqData->receivePr = receivePr; 4.87 reqData->reqType = receive_type; 4.88 reqData->msgType = type; 4.89 + reqData->nextReqInHashEntry = NULL; 4.90 4.91 VMS__add_sem_request( reqData, receivePr ); 4.92 VMS__suspend_procr( receivePr ); 4.93 @@ -330,6 +340,7 @@ 4.94 reqData->receivePr = receivePr; 4.95 reqData->sendPr = sendPr; 4.96 reqData->reqType = receive_from_to; 4.97 + reqData->nextReqInHashEntry = NULL; 4.98 4.99 //On ownership -- remove inside the send after receive successful. 4.100 // Below, add ownership when come back from suspend