Instead of introducing an exception: false argument to have non_block return nil rather than raise, we can clearly document that a timeout of 0 immediately returns.
The code is refactored a bit to avoid doing a time calculation in such case.
Related issues
Feature #18982: Add an `exception: false` argument for Queue#push, Queue#pop, SizedQueue#push and SizedQueue#pop
thread_sync.c: Clarify and document the behavior of timeout == 0
[Feature #18982]
Instead of introducing an
exception: falseargument to havenon_blockreturn nil rather than raise, we can clearly document that a timeout of 0
immediately returns.
The code is refactored a bit to avoid doing a time calculation in
such case.