Repository navigation
-
Fix locks and channels when a panic is caught with
catch_unwindand the execution goes on. AMutexorRwLockguard dropped while its task panicked closed the lock's semaphore and dropped its waiters without waking them, so a task waiting for the lock was never woken and Shuttle reported a deadlock that std doesn't have;lock()could also panic on anunwrapinstead of returning aPoisonErrorif another task panicked between itsis_closed()check and its acquire, andinto_inner()on a poisoned lock panicked. A release while panicking is now an ordinary release that hands the lock to the next waiter, and the innerstd::synclock reports poisoning, as in std. More generally, Shuttle's ownDrophandlers now do their bookkeeping while a task unwinds, so that, for example, a channelSenderdropped during a caught panic disconnects the channel and its receiver does not wait forever.ExecutionState::should_stopnow returnstrueonly when the execution is being abandoned or there is no execution state to update, not whenever the current thread is panicking. The tokio wrapper's primitives built onBatchSemaphoreget the same behavior, which matches tokio's. (#401) -
Model the atomics'
fetch_updateas std does, with acompare_exchange_weakloop, instead of running the callback inside a single step. A callback that accessed another sync primitive introduced a scheduling point between the load and the store, so a concurrent write could be lost; the callback now runs again on the new value, as in std. Addupdateandtry_updateto the atomic types, which std added in Rust 1.95.fetch_updateis kept and not marked deprecated. (#405) -
Add
AtomicBool::fetch_not, which std added in Rust 1.81, and theAtomicPtrmethods that std added in Rust 1.91:fetch_ptr_add,fetch_ptr_sub,fetch_byte_add,fetch_byte_sub,fetch_or,fetch_andandfetch_xor, and itsfmt::Pointerimpl. The bitwise operations keep the pointer's provenance, as in std. (#408) -
shuttle-tokio: when aNotifiedthatnotify_onepicked is dropped before it completes (for example by aselect!that completes another branch), the notification is now passed on to another waiter, or stored as a permit if there is none, as in tokio. It used to be lost, so another waiter could wait forever and Shuttle reported a deadlock that tokio does not have. (#402) -
Publish
shuttle0.9.9,shuttle-engine0.1.7,shuttle-std0.1.5 andshuttle-tokio-impl-inner0.1.6.shuttle-stdrequiresshuttle-engine0.1.7, since its locks rely on a release while panicking no longer closing the semaphore, andshuttlerequires both.shuttle-schedulersis unchanged at 0.1.1; it takesshuttle-engineas^0.1.1, so it builds against 0.1.7 as it stands. The already-publishedshuttle-tokio-impl0.1.2 andshuttle-tokio1.0.0 require inner as^0.1.5and re-export it with a glob, so they pick up theNotifyfix without being republished.