Top Level Namespace
Defined in:
Method Summary
-
sleep(seconds : Number)
Blocks the current fiber for the specified number of seconds.
-
sleep(time : Time::Span)
Blocks the current Fiber for the specified time span.
-
timeout(seconds : Number, raise_on_timeout : Bool = true, raise_on_exception : Bool = true, &blk)
This timeout implementation wraps a block inside of another fiber.
Method Detail
Blocks the current fiber for the specified number of seconds.
While this fiber is waiting this time, other ready-to-execute fibers might start their execution.
Blocks the current Fiber for the specified time span.
While this fiber is waiting this time, other ready-to-execute fibers might start their execution.
This timeout implementation wraps a block inside of another fiber. Because there isn't a pre-emptive scheduler, timeouts can not be externally forced if the code inside of the block doesn't allow opportunities for the scheduler to move execution to another fiber. If that is permitted, through IO, or sleep, or yields, then this method can work to enforce a timeout around code that might otherwise block.