divanebaba wrote:
With overloaded, I mean, the timer itself is triggered every second. The timer contains a loop, which repeat itself every second too. Before the loop repeats, the timer gets triggered again.
I believe a Timer can only re-fire once it is complete, so it shouldn't be doing that. Adding some more debug lines seems to confirm it:
Code: Select all
Thread1:
FileAppend , Thread 1 starting`n, debug.txt
loop
{
FileAppend , Thread 1`n , debug.txt
sleep 1000
sleep -1
}
return
Thread2:
FileAppend , Thread 2 starting`n, debug.txt
loop
{
FileAppend , Thread 2`n , debug.txt
sleep 1000
sleep -1
}
return
Result:
Code: Select all
Thread 1 starting
Thread 1
Thread 2 starting
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
Thread 2
The problem is I have a process detection thread timer which needs to go into a sleep loop once it detects a process. Then elsewhere in my script I have messageboxes which go into their own wait loops while waiting for user to click ok or cancel. The two clash and the messagebox wait loop gets blocked once a process is detected. For now I have avoided the situation by not allowing messageboxes while a process is detected, but it would be nice to forcibly hand over execution to underlying sleeping messagebox thread with a command such as sleep -1.