循环处于活动状态时,计时器是否正在运行? [英] Are timers running, while loops are active?
问题描述
这是我的代码:
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.
此时仿真停滞了,我的面板进入了Windows-无响应,这是我结束的唯一方法
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.
我认为唯一的解释是,当我在<$ c中时,计时器需要更多时间,或者根本不执行$ c> do ... while 语句。 (与while {}相同)
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?
推荐答案
好吧,我总是找到一种解决方法,因为CAPL在stackoverflow上不太流行...
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.
这篇关于循环处于活动状态时,计时器是否正在运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!