Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. kernel
  6. SpinLockGuard

SpinLockGuard

Struct SpinLockGuard 

Source
pub struct SpinLockGuard<'lock, K: Kernel, T> {
    lock: &'lock SpinLock<K, T>,
    _preempt_guard: PreemptDisableGuard<K>,
    _inner_guard: <<K as Arch>::BareSpinLock as BareSpinLock>::Guard<'lock>,
}

Fields§

§lock: &'lock SpinLock<K, T>§_preempt_guard: PreemptDisableGuard<K>§_inner_guard: <<K as Arch>::BareSpinLock as BareSpinLock>::Guard<'lock>

Implementations§

Source§

impl<K: Kernel> SpinLockGuard<'_, K, SchedulerState<K>>

Source

pub(super) fn try_reschedule(self, kernel: K, reason: RescheduleReason) -> Self

Reschedule if preemption is enabled

Source

fn thread_initialize( &self, _kernel: K, thread: &mut Thread<K>, process_handle: ProcessHandle<K>, ) -> Result<()>

Source

pub fn thread_initialize_kernel<A: ThreadArg>( &mut self, kernel: K, thread: &mut Thread<K>, entry_point: fn(K, A), arg: A, )

Source

pub fn thread_reinitialize_kernel<A: ThreadArg>( &mut self, kernel: K, thread: &mut Thread<K>, entry_point: fn(K, A), arg: A, )

Source

pub unsafe fn thread_initialize_non_priv( &mut self, kernel: K, thread: &mut Thread<K>, process_handle: ProcessHandle<K>, initial_pc: usize, initial_sp: usize, args: (usize, usize, usize), ) -> Result<()>

§Safety

It is up to the caller to ensure that *process is valid. Initialize the mutable parts of the non privileged thread, must be called once per thread prior to starting it

Source

pub(crate) fn thread_get_state(&self, thread: &ThreadHandle<K>) -> State

Source

pub fn thread_terminate( &mut self, thread_handle: &mut ThreadHandle<K>, status: ExitStatus, ) -> Result<()>

Request termination of the referenced thread.

This is an ASYNCHRONOUS operation. The thread is marked as terminating, but it may not exit immediately.

Source

pub(crate) fn thread_terminate_internal( &mut self, thread: &mut Thread<K>, status: ExitStatus, ) -> Result<()>

Source

pub(crate) fn thread_signal_join( self, kernel: K, thread: &mut ThreadHandle<K>, ) -> Self

Source

pub(crate) fn thread_try_join( self, kernel: K, thread_handle: ThreadHandle<K>, signaler: Option<EventSignaler<K>>, ) -> (Self, TryJoinResult<K>)

Source

pub(crate) fn thread_cancel_try_join( &mut self, thread_handle: &mut ThreadHandle<K>, )

Source

pub(crate) fn thread_exit(self, kernel: K)

Performs the low-level operations to exit the current thread.

This method handles the actual state transitions and cleanup for thread exit. It expects the exit_status to have been set by the caller if necessary.

§Differences from other exit/terminate functions:
  • exit_thread: A high-level wrapper that takes an explicit status, sets it on the thread, and then calls this method. It does not return.
  • terminate: Asynchronous requests to terminate a thread/process. They set the target’s state to terminating but rely on thread_exit being called later to perform the actual exit.
Source

pub(crate) fn thread_is_terminating(&self, thread: &ThreadHandle<K>) -> bool

Source

fn thread_remove_from_parent_process( self, kernel: K, thread: &mut Thread<K>, ) -> Self

Source§

impl<K: Kernel> SpinLockGuard<'_, K, SchedulerState<K>>

Source

pub fn process_terminate( &mut self, _kernel: K, process_handle: &ProcessHandle<K>, status: ExitStatus, )

Request termination of the referenced process and all its threads.

This is an ASYNCHRONOUS operation. The process and its threads are marked as terminating, but they may not exit immediately.

Source

pub fn process_signal_join( self, kernel: K, process: &mut ProcessHandle<K>, ) -> Self

Source

pub fn process_try_join( self, kernel: K, process_handle: ProcessHandle<K>, signaler: Option<EventSignaler<K>>, ) -> (Self, ProcessTryJoinResult<K>)

Source

pub fn process_cancel_try_join(&mut self, process_handle: &mut ProcessHandle<K>)

Source

unsafe fn process_remove_from_thread_list( self, kernel: K, process_handle: &mut ProcessHandle<K>, thread: &mut Thread<K>, ) -> Self

§Safety

Caller must ensure that the thread is already in the processes thread list.

Source

pub fn process_add_thread( &self, process_handle: &mut ProcessHandle<K>, thread_handle: &mut ThreadHandle<K>, ) -> Result<()>

Trait Implementations§

Source§

impl<K: Kernel, T> Deref for SpinLockGuard<'_, K, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<K: Kernel, T> DerefMut for SpinLockGuard<'_, K, T>

Source§

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

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'lock, K, T> !RefUnwindSafe for SpinLockGuard<'lock, K, T>

§

impl<'lock, K, T> !UnwindSafe for SpinLockGuard<'lock, K, T>

§

impl<'lock, K, T> Forget for SpinLockGuard<'lock, K, T>

§

impl<'lock, K, T> Freeze for SpinLockGuard<'lock, K, T>
where &'lock SpinLock<K, T>: Freeze, PreemptDisableGuard<K>: Freeze, <<K as Arch>::BareSpinLock as BareSpinLock>::Guard<'lock>: Freeze,

§

impl<'lock, K, T> Move for SpinLockGuard<'lock, K, T>

§

impl<'lock, K, T> Send for SpinLockGuard<'lock, K, T>
where &'lock SpinLock<K, T>: Send, PreemptDisableGuard<K>: Send, <<K as Arch>::BareSpinLock as BareSpinLock>::Guard<'lock>: Send,

§

impl<'lock, K, T> Sync for SpinLockGuard<'lock, K, T>
where &'lock SpinLock<K, T>: Sync, PreemptDisableGuard<K>: Sync, <<K as Arch>::BareSpinLock as BareSpinLock>::Guard<'lock>: Sync,

§

impl<'lock, K, T> Unpin for SpinLockGuard<'lock, K, T>
where &'lock SpinLock<K, T>: Unpin, PreemptDisableGuard<K>: Unpin, <<K as Arch>::BareSpinLock as BareSpinLock>::Guard<'lock>: Unpin,

§

impl<'lock, K, T> UnsafeUnpin for SpinLockGuard<'lock, K, T>
where &'lock SpinLock<K, T>: UnsafeUnpin, PreemptDisableGuard<K>: UnsafeUnpin, <<K as Arch>::BareSpinLock as BareSpinLock>::Guard<'lock>: UnsafeUnpin,

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
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

fn cast_into(self) -> U

§

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.