pub struct EventSignaler<K: Kernel> {
event: NonNull<Event<K>>,
}Expand description
A signaler for an Event
EventSignaler is returned from Event::get_signaler() and is used to
signal the referenced Event. It can be cloned and the referenced Event
will panic if it is dropped when any EventSignalers still reference it.
Fields§
§event: NonNull<Event<K>>Implementations§
Source§impl<K: Kernel> EventSignaler<K>
impl<K: Kernel> EventSignaler<K>
fn event(&self) -> &Event<K>
Sourcepub fn signal_and_wake(self)
pub fn signal_and_wake(self)
Signals the Event and wakes any waiting threads, rescheduling if needed.
Consumes the signaler so no references to the event remain before threads are woken, which avoids use-after-free on stack-allocated events.
For long-lived events, the signaler can be cloned to signal multiple times
or from multiple threads. It is up to the user to ensure that the
Event is only dropped after all signalers are dropped.
§Interrupt context
This method is safe to call in an interrupt context.
Sourcepub(crate) fn signal_and_wake_locked<'a>(
self,
kernel: K,
sched: SpinLockGuard<'a, K, SchedulerState<K>>,
) -> SpinLockGuard<'a, K, SchedulerState<K>>
pub(crate) fn signal_and_wake_locked<'a>( self, kernel: K, sched: SpinLockGuard<'a, K, SchedulerState<K>>, ) -> SpinLockGuard<'a, K, SchedulerState<K>>
Sets the Event’s state to signaled and wakes waiters while holding the scheduler lock.
Consumes the signaler, matching Self::signal_and_wake.
§Interrupt context
This method is safe to call in an interrupt context.
Sourcepub(crate) fn signal_and_dequeue_locked<'a>(
self,
sched: SpinLockGuard<'a, K, SchedulerState<K>>,
wake_list: &mut WakeList<K>,
) -> SpinLockGuard<'a, K, SchedulerState<K>>
pub(crate) fn signal_and_dequeue_locked<'a>( self, sched: SpinLockGuard<'a, K, SchedulerState<K>>, wake_list: &mut WakeList<K>, ) -> SpinLockGuard<'a, K, SchedulerState<K>>
Signals the event and dequeues waiters into wake_list without waking them.
Consumes self so no signaler references remain before the caller wakes the threads.
Trait Implementations§
Source§impl<K: Kernel> Clone for EventSignaler<K>
impl<K: Kernel> Clone for EventSignaler<K>
Source§impl<K: Kernel> Drop for EventSignaler<K>
impl<K: Kernel> Drop for EventSignaler<K>
impl<K: Kernel> Send for EventSignaler<K>
impl<K: Kernel> Sync for EventSignaler<K>
Auto Trait Implementations§
impl<K> !RefUnwindSafe for EventSignaler<K>
impl<K> !UnwindSafe for EventSignaler<K>
impl<K> Forget for EventSignaler<K>
impl<K> Freeze for EventSignaler<K>where
NonNull<Event<K>>: Freeze,
impl<K> Move for EventSignaler<K>
impl<K> Unpin for EventSignaler<K>where
NonNull<Event<K>>: Unpin,
impl<K> UnsafeUnpin for EventSignaler<K>where
NonNull<Event<K>>: UnsafeUnpin,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)