pub struct Rseq { /* private fields */ }Expand description
The restartable sequence for the current thread.
This structure is used to store the restartable sequence information for the current thread. It is registered with the kernel when the thread is created and unregistered when the thread is destroyed.
Implementations§
Source§impl Rseq
impl Rseq
Sourcepub unsafe fn try_get() -> Option<Self>
pub unsafe fn try_get() -> Option<Self>
Returns the restartable sequence for the current thread if registered.
§Safety
The returned object must not be used after the current thread calls
rseq_unregister_thread().
Sourcepub fn as_ptr(&self) -> *mut zx_rseq_t
pub fn as_ptr(&self) -> *mut zx_rseq_t
Returns a pointer to the zx_rseq_t structure.
The returned pointer is only valid until the current thread calls
rseq_unregister_thread().
Useful for accessing the zx_rseq_t structure from inline assembly.
Sourcepub unsafe fn current_cpu(&self) -> u32
pub unsafe fn current_cpu(&self) -> u32
Reads the current CPU ID.
The current CPU can change at any time. Useful for preparing for a restartable sequence.
§Safety
This method cannot be used after the current thread calls rseq_unregister_thread(). That
invariant is required by the safety contract of get() as well.
Sourcepub unsafe fn activate(
&self,
critical_section: RseqCriticalSection,
) -> RseqScope
pub unsafe fn activate( &self, critical_section: RseqCriticalSection, ) -> RseqScope
Activate a critical section.
The critical section is defined by the critical_section parameter. The critical section is
active until the returned RseqScope is dropped.
§Safety
The caller must ensure that the returned RseqScope is dropped before calling
rseq_unregister_thread().