RobustListHead

Struct RobustListHead 

Source
#[repr(C)]
pub struct RobustListHead { pub head: *mut c_void, pub off: c_long, pub pending: *mut c_void, }
Expand description

健壮列表头部结构体(struct robust_list_head)

这个结构体是用户空间维护的,用于告诉内核当前线程持有健壮 futex 锁的列表信息。 示例用法(在需要时使用 volatile 访问):

fn access_robust_head(head: &mut RobustListHead) {
   unsafe {
       // 安全地读取 head 字段的 volatile 值
       let first_lock_ptr = head.head.read_volatile();
       // 安全地写入 head 字段的 volatile 值
       head.head.write_volatile(core::ptr::null_mut());
   }
}

Fields§

§head: *mut c_void

head: volatile void *volatile head; 指向当前线程拥有的第一个健壮 futex 锁。 在 C 中是 volatile void *,在 Rust 中使用 *mut c_void 或 *mut u8。 注意:volatile 访问必须通过 raw pointer 的 read/write_volatile 方法来实现,而不是在类型定义中。

§off: c_long

off: long off; 列表项(futex 锁)中 owner_tid 字段相对于列表头部的字节偏移量。

§pending: *mut c_void

pending: volatile void *volatile pending; 指向一个正在等待被释放或修复的 futex 锁。

Auto Trait Implementations§

§

impl Freeze for RobustListHead

§

impl RefUnwindSafe for RobustListHead

§

impl !Send for RobustListHead

§

impl !Sync for RobustListHead

§

impl Unpin for RobustListHead

§

impl UnwindSafe for RobustListHead

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.