Expand description
A oneshot channel whose receiver blocks the calling OS thread.
This is the synchronous analogue of tokio::sync::oneshot, for code that must wait
for a value produced elsewhere without being async (e.g. execution threads blocking
until an object version is committed). It is a thin wrapper over the [oneshot]
crate that adds a Receiver::blocking_recv tailored to Sui’s execution model:
- The wait always begins with a non-blocking
try_recv, so a value that is already available is returned without any side effects. - If it must block, it first releases the thread’s execution permit so other execution can proceed (see that module for the deadlock rationale).
- Under msim, parking the OS thread would hang the single-threaded simulator, so it instead polls in a loop, yielding the simulated thread quantum between checks. This would busy-wait on a real system, but the simulator only wakes the thread at a controlled rate, and only blocking-pool threads may wait this way.
Structs§
Enums§
- TryRecv
Error - Error returned by
try_recvwhen no value is available.
Functions§
- channel
- Create a new oneshot channel.