Skip to content

enough 0.4.5, almost-enough 0.4.5

Latest

Choose a tag to compare

@lilith lilith released this 07 Oct 08:11

enough 0.4.5

Added

  • AsStopReason: the StopReason an error represents, if any; StopReason implements it (7e3fd28)
  • live() on dyn Stop and its + Send / + Send + Sync forms: the stop, or None if it can never stop, for checking a &dyn Stop in a hot loop (ae5d376)

Changed

  • Stop::check, should_stop and the forwarding impls are #[track_caller], so an instrumented stop can attribute a poll to its call site; no signature change (5caac7e)
  • The crates.io page is this crate's own README, whose examples compile as doctests, instead of the workspace README (bd674e8, 5b8315d, 3909cea)

almost-enough 0.4.5

Added

  • PollMeter<S> behind the opt-in poll-meter feature: per-call-site histograms of the gaps between polls, flagging slow gaps and poll storms; StopExt::metered() wraps any stop (2236d17, 5caac7e)
  • DebouncedTimeout::clear_calibration(): the next two checks read the clock and set how often it is read; calibration, at creation too, now times two consecutive checks (af0eaef)

Changed

  • cancel() is a Release swap and is_cancelled() an Acquire load on Stopper, StopSource, ChildStopper and SyncStopper, so a thread whose is_cancelled() returns true sees what was written before the cancel it observed; checks are unchanged (4fd6dbd)
  • ChildStopper walks ChildStopper parents without a vtable call per level; each node is 8 bytes larger (5283eda)
  • StopToken drops its SyncStopper arm, so check is two branches instead of a jump table on x86-64 (5d53d06)
  • BoxedStop wraps a StopToken and takes its fast paths; still not Clone (d2e41e8)
  • StopToken::from_arc(Arc<Stopper>) checks the flag directly, as StopToken::new does; an Arc<SyncStopper> stays behind the vtable (c5d4d6c)
  • PollMeter looks call sites up by Location address: 693 → 308 instructions per poll (a37d1cd)
  • README: library functions take Option<&dyn Stop>, or a StopToken to store or thread the stop, instead of impl Stop; one line on each type to reach for (70302bf)
  • Requires enough 0.4.5 (5b8315d)

Deprecated

  • BoxedStop and StopExt::into_boxed, in favor of StopToken and into_token() (97d04f9)

Fixed

  • alloc turns on enough's alloc, so Box<dyn Stop> and Arc<dyn Stop> are stops in a build that uses only almost-enough (667b66b, 22cb41a)
  • DebouncedTimeout reads the clock at least every 64 checks, so a slowdown can no longer make it stop seconds to a minute late; once one thread sharing it times out, every later check stops (e152409)
  • Docs: WithTimeout states its per-check clock read, DebouncedTimeout's calibration is described, and every README example compiles (0ca1e56, 69eb567)

What's Changed

  • docs(enough): show how to construct + flip a real cancellation token by @lilith in #11
  • docs(almost-enough): add install/version + cross-thread cancel example + Send/Sync by @lilith in #12
  • docs: enough-tokio consumer deps + enough-ffi from_ptr type/null/thread-safety contracts by @lilith in #13
  • perf(almost-enough): BoxedStop shares StopToken's dispatch by @lilith in #29
  • perf(almost-enough): PollMeter looks call sites up by Location address by @lilith in #32
  • perf(enough-tokio): TokioStop reads an atomic flag once it is checked often by @lilith in #28
  • feat(enough): dyn Stop::live, the stop or None when it can never stop by @lilith in #34
  • feat(enough): AsStopReason, the StopReason an error represents by @lilith in #40
  • chore(almost-enough): deprecate BoxedStop in favor of StopToken by @lilith in #35
  • perf(almost-enough): StopToken drops its SyncStopper arm, so check has no jump table by @lilith in #36
  • feat(almost-enough, enough-ffi): Release cancel(), Acquire is_cancelled(); checks unchanged by @lilith in #30
  • perf(almost-enough): ChildStopper walks ChildStopper parents without vtable calls by @lilith in #38
  • fix(almost-enough): bound how late DebouncedTimeout stops after checks slow down by @lilith in #31
  • feat(almost-enough): DebouncedTimeout::clear_calibration by @lilith in #42
  • test(almost-enough): PollMeter's histogram test without sleeps by @lilith in #41
  • docs: WithTimeout's per-check cost, a README example that compiles, StopToken's size by @lilith in #37
  • bench: measurement records for #30, #31, #38 and #42 by @lilith in #39
  • release: enough 0.4.5, almost-enough 0.4.5, enough-ffi 0.4.1, enough-tokio 0.5.1 by @lilith in #43

Full Changelog: v0.4.4...v0.4.5