Skip to content

v0.9.9

Latest

Choose a tag to compare

@sarsko sarsko released this 29 Oct 00:56
· 6 commits to main since this release
v0.9.9
675fea6
  • Fix locks and channels when a panic is caught with catch_unwind and the execution goes on. A Mutex or RwLock guard 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 an unwrap instead of returning a PoisonError if another task panicked between its is_closed() check and its acquire, and into_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 inner std::sync lock reports poisoning, as in std. More generally, Shuttle's own Drop handlers now do their bookkeeping while a task unwinds, so that, for example, a channel Sender dropped during a caught panic disconnects the channel and its receiver does not wait forever. ExecutionState::should_stop now returns true only 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 on BatchSemaphore get the same behavior, which matches tokio's. (#401)

  • Model the atomics' fetch_update as std does, with a compare_exchange_weak loop, 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. Add update and try_update to the atomic types, which std added in Rust 1.95. fetch_update is kept and not marked deprecated. (#405)

  • Add AtomicBool::fetch_not, which std added in Rust 1.81, and the AtomicPtr methods that std added in Rust 1.91: fetch_ptr_add, fetch_ptr_sub, fetch_byte_add, fetch_byte_sub, fetch_or, fetch_and and fetch_xor, and its fmt::Pointer impl. The bitwise operations keep the pointer's provenance, as in std. (#408)

  • shuttle-tokio: when a Notified that notify_one picked is dropped before it completes (for example by a select! 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 shuttle 0.9.9, shuttle-engine 0.1.7, shuttle-std 0.1.5 and shuttle-tokio-impl-inner 0.1.6. shuttle-std requires shuttle-engine 0.1.7, since its locks rely on a release while panicking no longer closing the semaphore, and shuttle requires both. shuttle-schedulers is unchanged at 0.1.1; it takes shuttle-engine as ^0.1.1, so it builds against 0.1.7 as it stands. The already-published shuttle-tokio-impl 0.1.2 and shuttle-tokio 1.0.0 require inner as ^0.1.5 and re-export it with a glob, so they pick up the Notify fix without being republished.