ksync/
raw_userspace_mutex.rs1use super::RawLock;
6use lock_api::RawMutex as _;
7use pin_init::{PinInit, pin_init_from_closure};
8
9pub type RawMutex = fuchsia_sync::RawMutex;
10
11impl RawLock for fuchsia_sync::RawMutex {
12 type LockEntry = ();
13 type GuardState = ();
14
15 #[inline]
16 fn init() -> impl PinInit<Self, core::convert::Infallible> {
17 unsafe {
18 pin_init_from_closure(|slot| {
19 core::ptr::write(slot, fuchsia_sync::RawMutex::INIT);
20 Ok(())
21 })
22 }
23 }
24
25 #[inline]
26 fn as_mut_ptr(&self) -> *mut core::ffi::c_void {
27 core::ptr::null_mut()
28 }
29
30 #[inline]
31 unsafe fn acquire(
32 &self,
33 _lcid: *mut core::ffi::c_void,
34 _entry: *mut Self::LockEntry,
35 ) -> Self::GuardState {
36 self.lock();
37 }
38
39 #[inline]
40 unsafe fn release(&self, _entry: *mut Self::LockEntry, _state: Self::GuardState) {
41 unsafe {
43 self.unlock();
44 }
45 }
46}