wait

fnint wait(double seconds = - 1.0) nothrow @nogc

Waits for events with an optional timeout.

This function waits for and processes events. It can wait indefinitely or for a specified amount of time.

Parameters

secondsMaximum time to wait in seconds.
0return immediately after processing pending events.
Negativewait indefinitely (until an event occurs).

Returns

Non-zero if there are still visible windows

Example:

// Process events for up to 0.1 seconds
while (wait(0.1)) {
   // Do background work
}