Termisu::FFI::Context
Constants
POLL_CANCELLATION_INTERVAL = 1.millisecond
Bound the time an FFI poll waits before observing cross-thread shutdown. Crystal channels are scheduler-local in supported non-preview_mt builds, while atomics and OS sleeps work from arbitrary host threads.
Constructors
Instance methods
close
SourcePolls non-blockingly between short OS sleeps so close can cancel an indefinite (or very long) wait before draining operation leases. Avoiding scheduler waits is required because the C ABI may run on a foreign thread. The ownership lease remains held until close completes all cleanup below.
termisu
Sourcewith_operation
Runs one FFI operation while preventing close from crossing its lifetime. The second closing check closes the race between the first check and the counter increment: such a caller backs out without touching Termisu.