interrupt-ref-cell 0.1.1

A `RefCell` for sharing data with interrupt handlers or signal handlers on the same thread.
Documentation
  • Coverage
  • 96.67%
    29 out of 30 items documented25 out of 29 items with examples
  • Size
  • Source code size: 52.27 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • mkroening/interrupt-ref-cell
    0 0 4
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mkroening

interrupt-ref-cell

Crates.io docs.rs CI

A RefCell for sharing data with interrupt handlers or signal handlers on the same thread.

use interrupt_ref_cell::{InterruptRefCell, LocalKeyExt};
 
thread_local! {
    static X: InterruptRefCell<Vec<i32>> = InterruptRefCell::new(Vec::new());
}
 
fn interrupt_handler() {
    X.with_borrow_mut(|v| v.push(1));
}

X.with_borrow(|v| {
    // Raise an interrupt
    raise_interrupt();
    assert_eq!(*v, vec![]);
});
 
// The interrupt handler runs
 
X.with_borrow(|v| assert_eq!(*v, vec![1]));

For API documentation, see the docs.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.