stop-cigarette
stop-cigarette is a dependency-free Rust library for cooperative,
first-wins STOP signals.
The Cocoshiga STOP principle
This crate gives a concrete meaning to STOP のココシガの理:
A valid STOP is preserved where it happens, propagated to every holder, and never overwritten by a later voice.
The first valid request records who stopped the work and why. Every clone sees the same immutable record. Later requests are idempotent and return the original record instead of changing history.
Example
use ;
let signal = new;
let worker_signal = signal.clone;
assert!;
let outcome = signal.request_stop?;
assert_eq!;
let stopped = worker_signal.checkpoint.unwrap_err;
assert_eq!;
# Ok::
Guarantees
- First valid STOP wins, even across competing threads.
- The actor and reason are immutable after stopping.
- Clones share one signal and one stop record.
- Repeated requests are safe and report
AlreadyStopped. - Invalid empty actors or reasons never mutate the signal.
- The implementation uses only the Rust standard library.
This is a cooperative signal: code must call checkpoint or is_stopped.
It does not forcibly terminate threads or processes.
License
MIT