Suspending a program or sending an alarm interrupt to a processΒΆ
wait |
Suspend the program and await an alarm interrupt |
wakeup |
Send an alarm interrupt to a process |
SYNTAX
wait
wakeup task_number
The wait command suspends the current program, causing it to sleep until an alarm interrupt is sent to it. Upon receiving an alarm interrupt, processing continues with the statement following the wait command.
The wakeup command sends an alarm interrupt to the process whose id is specified in task_number. The alarm call can be sent to any process whose id is known and which is capable of accepting the interrupt. It is most commonly used to restart a Sculptor program that has been paused by the wait command. The suspended program will resume processing from the point at which it was suspended.
The wakeup command can also be used to terminate the sleep command from within an event function called by pressing a hot button (a button with the style flag WS_HOTBUTTON). To do this, use the form:
wakeup 0
See Button style.
NOTES
Apart from the use of wakeup 0 to interrupt the sleep command, these commands are only available on UNIX and certain similar operating systems. If the operating system does not support these commands, they are ignored.
It is recommended that these commands only be used with a good understanding of the equivalent operating system function. For example, on UNIX it is wise to ensure that at least a few seconds elapse before a program that has paused can receive an alarm interrupt. Otherwise, because of task switching, it is possible for the program to receive and ignore the alarm interrupt before it has completed the wait operation. This would cause the program to sleep forever.
A simple way of determining the task id of another program is for each participating program to write its id into a shared file.