问题
Here's my code:
setTimer(delay, (SEEDKEY_MAXTRY * SEEDKEY_FREQ) + (LOGIN_MAXTRY * LOGIN_FREQ));
do {
// waits, until all operations have been executed;
} while(isTimerActive(delay));
I know exactly how long it takes to execute my commands, so I set the timer delay
to the explicit value. I have to wait, until I return some values.
The simulation stucks at this point, my panels go into Windows-"No response" and the only way I can end the simulation is via Taskmanager.
I think the only explanation is, that the timers need more time, or are not executed at all, while I am in the do ... while
statement. (same with while {})
Can someone confirm this thought, or prove me wrong by giving me a solution to my problem?
回答1:
Ok I always find a workaround, since CAPL is not too popular on stackoverflow...
For the readers, that want to know how:
I just used a global status variable to restrict the user from performing the action until my processing gets finished.
来源:https://stackoverflow.com/questions/38048777/are-timers-running-while-loops-are-active