JoobQ::BackgroundLoop
Inherits Reference < Object
A cancellable periodic fiber.
stop wakes a loop that is sleeping between iterations and waits for the
fiber to exit, so no iteration runs after stop has returned. Flag-only
stops are racy once fibers may run on other threads (Crystal's default
execution context is parallel).
Every start owns its own run state, so a restart after a stop that
timed out can never leave two live fibers sharing one flag.
Constants
Constructors
Instance methods
Starts the loop. The block runs one iteration and returns how long to sleep before the next one. Returns false when already running.
Stops the loop and waits (up to wait) for its fiber to exit. Returns
false when the loop was not running. When called from inside the loop
body itself it does not wait (a fiber cannot join itself).