Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 818 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 818 Bytes

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.