#interrupt #signals #disable #signal #without #no-alloc

no-std interrupt-mutex

用于与中断处理程序或信号处理程序共享数据的互斥锁

1 个不稳定版本

0.1.0 2023年10月8日

983Unix APIs 中排名

Download history · Rust 包仓库 3/week @ 2024-03-13 · Rust 包仓库 11/week @ 2024-03-27 · Rust 包仓库 137/week @ 2024-04-03 · Rust 包仓库 231/week @ 2024-04-10 · Rust 包仓库 204/week @ 2024-04-17 · Rust 包仓库 46/week @ 2024-04-24 · Rust 包仓库 198/week @ 2024-05-01 · Rust 包仓库 120/week @ 2024-05-08 · Rust 包仓库 180/week @ 2024-05-15 · Rust 包仓库 162/week @ 2024-05-22 · Rust 包仓库 43/week @ 2024-05-29 · Rust 包仓库 200/week @ 2024-06-05 · Rust 包仓库 92/week @ 2024-06-12 · Rust 包仓库 244/week @ 2024-06-19 · Rust 包仓库 228/week @ 2024-06-26 · Rust 包仓库

779 每月下载量
2 个crate中使用 (通过 hermit-sync)

MIT/Apache

9KB
51 代码行数(不含注释)

interrupt-mutex

Crates.io docs.rs CI

用于与中断处理程序或信号处理程序共享数据的互斥锁。

// Make a mutex of your choice into an `InterruptMutex`.
type InterruptMutex<T> = interrupt_mutex::InterruptMutex<parking_lot::RawMutex, T>;

static X: InterruptMutex<Vec<i32>> = InterruptMutex::new(Vec::new());

fn interrupt_handler() {
    X.lock().push(1);
}

let v = X.lock();
// Raise an interrupt
raise_interrupt();
assert_eq!(*v, vec![]);
drop(v);

// The interrupt handler runs

let v = X.lock();
assert_eq!(*v, vec![1]);
drop(v);

有关API文档,请参阅文档

许可证

许可协议为以下之一

任选其一。

贡献

除非您明确表示,否则根据Apache-2.0许可证定义的任何有意提交以包含在作品中的贡献,都应双重许可如上所述,无需附加条款或条件。

依赖项

~2MB
~38K SLoC