interruptibleSleep

Sleep in small periods, checking the passed abort flag 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 flag is the same one the signal handler monitors. As such, take it by ref.

@system
void
interruptibleSleep
(
const Duration dur
,
const Flag!"abort"* abort
)

Parameters

dur Duration

Duration to sleep for.

abort Flag!"abort"*

Pointer to the "abort" flag which, if set, means we should interrupt and return early.

Examples

interruptibleSleep(1.seconds, abort);