Skip to main content

RawLock

Trait RawLock 

Source
pub unsafe trait RawLock: Sized {
    type DefaultPolicy: ExclusiveLockPolicy<Self>;

    // Required methods
    unsafe fn init(class_id: *const c_void) -> impl PinInit<Self>;
    fn as_mut_ptr(&self) -> *mut c_void;
}
Expand description

Trait defining a raw, un-instrumented synchronization lock abstraction.

Implementors of RawLock supply the platform-specific lock storage, in-place pinning initialization logic, and raw synchronization entry points.

§Safety

Implementors must represent a physical synchronization primitive with non-zero size whose as_mut_ptr uniquely identifies the underlying lock storage for the lifetime of &self.

Required Associated Types§

Source

type DefaultPolicy: ExclusiveLockPolicy<Self>

Default policy that should be used when acquiring this lock.

Required Methods§

Source

unsafe fn init(class_id: *const c_void) -> impl PinInit<Self>

Returns a PinInit block to initialize the raw lock in-place.

§Safety

The caller must ensure that class_id is either null or points to a valid, static LockClassId that remains valid for the lifetime of the lock.

Source

fn as_mut_ptr(&self) -> *mut c_void

Convert the raw lock reference to a standard c_void pointer for FFI.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§