interruptibleSleep

Sleep in small periods, checking the passed abort bool in between to see if we should break and return.

This is useful when a different signal handler has been set up, as triggering it won't break sleeps. This way it does, assuming the abort bool is the same one the signal handler monitors. As such, take it by ref.

@system
void
interruptibleSleep
(
const Duration dur
,
const ref bool abort
)

Parameters

dur Duration

Duration to sleep for.

abort bool

Reference to the bool flag which, if set, means we should interrupt and return early.

Examples

interruptibleSleep(1.seconds, abort);

Meta