Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison AnimationMaster.c @ 270:292393c6bef1
about to recover probes, so need to commit current state
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Wed, 16 Jan 2013 01:50:26 -0800 |
| parents | e6a68e7ea63f |
| children | bc5030385120 |
comparison
equal
deleted
inserted
replaced
| 14:098c51086089 | 15:77a8dc0f570c |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2010 OpenSourceResearchInstitute | 2 * Copyright 2012 OpenSourceResearchInstitute.org |
| 3 * | 3 * |
| 4 * Licensed under BSD | 4 * Licensed under BSD |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 | 7 |
| 24 inline void PRHandle_CreateSlave(PRReqst *req, SlaveVP *slave ); | 24 inline void PRHandle_CreateSlave(PRReqst *req, SlaveVP *slave ); |
| 25 void PRHandle_EndSlave( PRReqst *req, SlaveVP *slave ); | 25 void PRHandle_EndSlave( PRReqst *req, SlaveVP *slave ); |
| 26 | 26 |
| 27 | 27 |
| 28 //inline void masterFunction_SingleLang( PRLangEnv *protoLangEnv, AnimSlot *slot ); | 28 //inline void masterFunction_SingleLang( PRLangEnv *protoLangEnv, AnimSlot *slot ); |
| 29 inline void masterFunction( AnimSlot *slot ); | |
| 30 inline PRProcess * pickAProcess( AnimSlot *slot ); | 29 inline PRProcess * pickAProcess( AnimSlot *slot ); |
| 31 inline SlaveVP * assignWork( PRProcess *process, AnimSlot *slot ); | 30 inline bool32 assignWork( PRProcess *process, AnimSlot *slot ); |
| 32 | 31 |
| 33 /*The animationMaster embodies most of the animator of the language. The | 32 /*The animationMaster embodies most of the animator of the language. The |
| 34 * animator is what emodies the behavior of language constructs. | 33 * animator is what emodies the behavior of language constructs. |
| 35 * As such, it is the animationMaster, in combination with the plugin | 34 * As such, it is the animationMaster, in combination with the plugin |
| 36 * functions, that make the language constructs do their behavior. | 35 * functions, that make the language constructs do their behavior. |
| 92 } | 91 } |
| 93 } | 92 } |
| 94 | 93 |
| 95 | 94 |
| 96 inline | 95 inline |
| 97 void | 96 bool32 |
| 98 masterFunction( AnimSlot *slot ) | 97 masterFunction( AnimSlot *slot ) |
| 99 { //Scan the animation slots | 98 { //Scan the animation slots |
| 100 int32 magicNumber; | 99 int32 magicNumber; |
| 101 SlaveVP *slave; | 100 SlaveVP *slave; |
| 102 PRLangEnv *langEnv; | 101 PRLangEnv *langEnv; |
| 103 PRReqst *req; | 102 PRReqst *req; |
| 104 PRProcess *process; | 103 PRProcess *process; |
| 104 bool32 foundWork; | |
| 105 | 105 |
| 106 //Check if newly-done slave in slot, which will need request handled | 106 //Check if newly-done slave in slot, which will need request handled |
| 107 if( slot->workIsDone ) | 107 if( slot->workIsDone ) |
| 108 { slot->workIsDone = FALSE; | 108 { slot->workIsDone = FALSE; |
| 109 slot->needsWorkAssigned = TRUE; | 109 slot->needsWorkAssigned = TRUE; |
| 158 //Pick a process to get this slot | 158 //Pick a process to get this slot |
| 159 process = pickAProcess( slot ); | 159 process = pickAProcess( slot ); |
| 160 | 160 |
| 161 //Scan lang environs, looking for langEnv with ready work. | 161 //Scan lang environs, looking for langEnv with ready work. |
| 162 // call the Assigner for that lang Env, to get a slave for the slot | 162 // call the Assigner for that lang Env, to get a slave for the slot |
| 163 foundWork = | |
| 163 assignWork( process, slot ); | 164 assignWork( process, slot ); |
| 164 | 165 |
| 165 HOLISTIC__Record_Assigner_end; | 166 HOLISTIC__Record_Assigner_end; |
| 166 }//if slot needs slave assigned | 167 }//if slot needs slave assigned |
| 168 | |
| 169 return foundWork; | |
| 167 } | 170 } |
| 168 | 171 |
| 169 /*When several processes exist, use some pattern for picking one to give | 172 /*When several processes exist, use some pattern for picking one to give |
| 170 * the animation slot to. | 173 * the animation slot to. |
| 171 *First, it has to be a process that has work available. | 174 *First, it has to be a process that has work available. |
| 216 * override enables them to generate a custom assigner that uses info from | 219 * override enables them to generate a custom assigner that uses info from |
| 217 * all the languages in a unified way.. Don't really expect this to happen, | 220 * all the languages in a unified way.. Don't really expect this to happen, |
| 218 * but am making it possible. | 221 * but am making it possible. |
| 219 */ | 222 */ |
| 220 inline | 223 inline |
| 221 SlaveVP * | 224 bool32 |
| 222 assignWork( PRProcess *process, AnimSlot *slot ) | 225 assignWork( PRProcess *process, AnimSlot *slot ) |
| 223 { SlaveVP *returnSlv; | 226 { SlaveVP *returnSlv; |
| 224 int32 coreNum, slotNum; | 227 int32 coreNum, slotNum; |
| 225 PRMetaTask *assignedMetaTask; | 228 PRMetaTask *assignedMetaTask; |
| 226 | 229 |
| 240 langEnvsList = process->langEnvsList; | 243 langEnvsList = process->langEnvsList; |
| 241 numEnvs = process->numLangEnvs; | 244 numEnvs = process->numLangEnvs; |
| 242 for( envIdx = 0; envIdx < numEnvs; envIdx++ ) //keep langEnvs in hash & array | 245 for( envIdx = 0; envIdx < numEnvs; envIdx++ ) //keep langEnvs in hash & array |
| 243 { langEnv = langEnvsList[envIdx]; | 246 { langEnv = langEnvsList[envIdx]; |
| 244 if( langEnv->hasWork ) | 247 if( langEnv->hasWork ) |
| 245 { (*langEnv->slaveAssigner)( langEnv, slot ); //assigner calls PR to put slave/task into slot | 248 { (*langEnv->workAssigner)( langEnv, slot ); //assigner calls PR to put slave/task into slot |
| 246 goto ReturnAfterAssigningWork; //quit for-loop, cause found work | 249 goto ReturnAfterAssigningWork; //quit for-loop, cause found work |
| 247 //NOTE: bad search alg -- should start where left off, then wrap around | 250 //NOTE: bad search alg -- should start where left off, then wrap around |
| 248 } | 251 } |
| 249 } | 252 } |
| 250 //If reach here, then have searched all langEnv's & none have work.. | 253 //If reach here, then have searched all langEnv's & none have work.. |
