[−][src]Struct kernel::spinlock::Mutex
A RISC-V Mutex.
Fields
lock: u32
Indicate whether data is locked. Will be passed into C code.
name: &'static str
Lock name, for debug use
hart: UnsafeCell<i64>
HartID holding the lock
data: UnsafeCell<T>
Save actual data
Implementations
impl<T> Mutex<T>
[src]
pub const fn new(user_data: T, name: &'static str) -> Mutex<T>
[src]
pub fn into_inner(self) -> T
[src]
Consumes this mutex, returning the underlying data.
impl<T: ?Sized> Mutex<T>
[src]
fn obtain_lock(&self)
[src]
Obtain lock by test_and_set
pub fn lock(&self) -> MutexGuard<T>
[src]
Lock mutex and return a guard
unsafe fn holding(&self) -> bool
[src]
Test if lock is held by current hart
pub unsafe fn get(&self) -> &mut T
[src]
Directly get mutex data regardless whether it is locked or not