We’ve been able to put a fiber to sleep for a long time now, but a sleep can’t be interrupted, which means that the sleep’s timer always expires and we can’t cancel it and resume the fiber early —technically we can, but then the fiber will be resumed twice
. The sync shard for example, can’t implement some simple timeouts, like a timed wait on a condition variable, or a timeout on pool checkouts.
Hence RFC 0014 that proposes Fiber.sleep and a cancellation mechanism. The RFC already went through a first set of reviews and is ready for more general review ![]()
I’m trying out the implementation in the sync shard myself.