Sematre / rp-spinlockmutex

Rust Mutex based on the RP2040 hardware spinlock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rp-spinlockmutex

version license

A mutex implementation based on the rp2040 hardware spinlock.

Example

Fully working code can be found in examples/.

use rp_spinlockmutex::SpinlockMutex;
static MUTEX: SpinlockMutex<7, i32> = SpinlockMutex::new(0);

run_on_core1(|| {
    for _ in 0..10 {
        *MUTEX.lock() += 1;
    }
});

for _ in 0..10 {
    *MUTEX.lock() += 1;
}

assert_eq!(*mutex.lock(), 20);

License

Licensed under either of:

at your option.

About

Rust Mutex based on the RP2040 hardware spinlock

License:Apache License 2.0


Languages

Language:Rust 100.0%