1304 |
itScriptEvent->ignoreAllWaitCalls = false; |
itScriptEvent->ignoreAllWaitCalls = false; |
1305 |
itScriptEvent->handlerType = VM_EVENT_HANDLER_INIT; |
itScriptEvent->handlerType = VM_EVENT_HANDLER_INIT; |
1306 |
|
|
1307 |
/*VMExecStatus_t res = */ pScriptVM->exec( |
VMExecStatus_t res; |
1308 |
pEngineChannel->pScript->parserContext, &*itScriptEvent |
size_t instructionsCount = 0; |
1309 |
); |
const size_t maxInstructions = 200000; // aiming approx. 1 second max. (based on very roughly 5us / instruction) |
1310 |
|
bool bWarningShown = false; |
1311 |
|
do { |
1312 |
|
res = pScriptVM->exec( |
1313 |
|
pEngineChannel->pScript->parserContext, &*itScriptEvent |
1314 |
|
); |
1315 |
|
instructionsCount += itScriptEvent->execCtx->instructionsPerformed(); |
1316 |
|
if (instructionsCount > maxInstructions && !bWarningShown) { |
1317 |
|
bWarningShown = true; |
1318 |
|
dmsg(0,("[ScriptVM] WARNING: \"init\" event handler of instrument script executing for long time!\n")); |
1319 |
|
} |
1320 |
|
} while (res & VM_EXEC_SUSPENDED && !(res & VM_EXEC_ERROR)); |
1321 |
|
|
1322 |
pEngineChannel->pScript->pEvents->free(itScriptEvent); |
pEngineChannel->pScript->pEvents->free(itScriptEvent); |
1323 |
} |
} |