Example:
// Process events for up to 0.1 seconds
while (wait(0.1)) {
// Do background work
}int wait(double seconds = - 1.0) nothrow @nogcWaits for events with an optional timeout.
This function waits for and processes events. It can wait indefinitely or for a specified amount of time.
seconds | Maximum time to wait in seconds. |
0 | return immediately after processing pending events. |
Negative | wait indefinitely (until an event occurs). |
Example:
// Process events for up to 0.1 seconds
while (wait(0.1)) {
// Do background work
}