Functions | |
void | Disable_Wakeup_Events (double interval) |
Turns off wakeups. More... | |
void | Enable_Wakeup_Events (double interval) |
Starts a wakeup running within the computer. More... | |
Detailed Description
Function Documentation
◆ Disable_Wakeup_Events()
void Disable_Wakeup_Events | ( | double | interval | ) |
Turns off wakeups.
- Parameters
-
interval - The interval, in seconds, at which the wakeup should go off.
DETAILS
No additional details. See Enable_Wakeup_Events()
◆ Enable_Wakeup_Events()
void Enable_Wakeup_Events | ( | double | interval | ) |
Starts a wakeup running within the computer.
- Parameters
-
interval - The interval, in seconds, at which the wakeup should go off.
DETAILS
There are two ways to deal with wakeups in HOOPS. One way is to call Get_Wakeup(), which puts your process to sleep for the specified interval or until some other event has happened. The other way is to call Enable_Wakeup_Events() to start the clock running, do some useful work, and check back later with Await_Event() once the work is done.
When the wakeup expires, a wakeup event will be queued. The wakeup will be automatically rearmed and keep repeating indefinitely, expiring at regular intervals, until such time as it is disabled by your program. A repetitively-expiring wakeup such as this can be used, for example, to space out the frames of an animation that your system is more than keeping up with.
To implement a "one-shot" wakeup, disable the wakeup as soon as the first wakeup event has been received. You might use this kind of wakeup to provide a time-out for user input or for an error display.
NOTES
The Enable/Disable does not take effect until the next call to Await_Event() or Check_For_Events() . If it's going to be a while until that happens, you can call Check_For_Events() immediately to start the wakeup running.
The system keeps a count of how many times a particular interval has been enabled. The system only turns off the wakeup when the corresponding number of disables has been received. This allows lower levels of your program not to worry about whether the upper levels happen to be using the same wakeup.
For any given wakeup, at most two expiration events can be pending at a time in the event queue. If another expiration comes along while two are already pending, the wakeup is rearmed but no additional event is queued. This limit helps keep your program from getting way behind the clock.
The magnitude of interval can be as large as you please.
RESTRICTIONS
Flagging enabled events causes confusion when a window with events enabled becomes invisible. The work around is to disable events before setting the visibility to off.