See also: wait for
[wait ]timeS
timeS - time (seconds) to wait. Can be integer (like 10) or double (like 0.1). Special values:
0 or omitted | Just process messages that possibly are waiting in thread's message queue, regardless of opt waitmsg. |
-1 | Infinite. |
-2 | Autodelay. The wait time will be equal to the speed of the macro or function that directly called the current function. If there is no direct caller - default macro speed. |
Waits timeS seconds.
If timeS is simple digits, or begins with a digit, the wait keyword can be omitted. See examples.
The wait time precision is about 2 milliseconds (0.002 s). For example, wait 0.001 will probably wait 2 ms.
Note: If the thread has windows/dialogs or uses COM events or some Windows API functions that use Windows messages, you should avoid wait commands in it. Or use small time (<0.1). By default, messages are not processed while waiting, and your thread may temporarily hang. To process messages while waiting, use opt waitmsg.
Note: Don't use Windows API wait functions, because then QM cannot properly end the thread on user request. QM then terminates thread, which causes a big memory leak and possibly more bad things. Also, opt waitmsg is not applied.
QM 2.4.0. wait uses alertable waiting. For example, QueueUserAPC can be used to run a function in the waiting thread.
Wait 0.5 seconds: wait 0.5 or: 0.5 Wait 15 seconds; the wait time is variable wt: int wt=15 wait wt Wait 2 seconds: double F=0.5 4*F