[][src]Module ruspiro_lock::semaphore

Semaphore implementation. It uses atomic memory locks to ensure the semaphore is exclusively accessed while checking

or updating it's value. On Raspbarry Pi this will only work if the MMU has been properly configured. Otherwise those operations may just hang.

Example

static SEMA: Semaphore = Semaphore::new(1);
 
fn main () {
    SEMA.down(); // will only return if the counter could be decreased
    // do something
 
    SEMA.up(); // increase the counter for another usage
}

Structs

Semaphore