embassy-usb-synopsys-otg

Crates

git

Versions

default

Flavors

Skip to main content

SharedRawMutex

Trait SharedRawMutex 

Source
pub unsafe trait SharedRawMutex {
    // Required methods
    fn share(&self) -> Self;
    fn lock<R>(&self, f: impl FnOnce() -> R) -> R;
}
Expand description

A handle to the lock that guards the driver’s hardware access.

The driver passes the lock to several parts, so it takes a handle that it can duplicate. Every handle that share returns locks the same lock.

Handles are passed to other contexts only as their Send and Sync implementations allow.

§Safety

  • share returns a handle that locks the same lock as self.
  • While lock runs f, no other context can run lock on a handle to the same lock.

Required Methods§

Source

fn share(&self) -> Self

Returns another handle to the same lock.

Source

fn lock<R>(&self, f: impl FnOnce() -> R) -> R

Locks the lock while f runs.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SharedRawMutex for CriticalSectionRawMutex

Source§

fn share(&self) -> Self

Source§

fn lock<R>(&self, f: impl FnOnce() -> R) -> R

Source§

impl<M: RawMutex> SharedRawMutex for &M

Source§

fn share(&self) -> Self

Source§

fn lock<R>(&self, f: impl FnOnce() -> R) -> R

Implementors§