pub struct WakeInfo {
pub events: ArrayVec<UnsafeCell<k_poll_event>, 1>,
pub timeout: Timeout,
pub context: Context<'static>,
/* private fields */
}
Expand description
Futures will need to be able to set the events and timeout of this waker. Because the Waker is parameterized, they will not have access to the whole WorkWaker, but only this WakeInfo.
Fields§
§events: ArrayVec<UnsafeCell<k_poll_event>, 1>
Events to use for our next wakeup. Currently cleared before calling the future (although this discards the wakeup reason, so needs to be fixed).
timeout: Timeout
Timeout to use for the next wakeup. Will be set to Forever before calling the Future’s poll.
context: Context<'static>
A Context to use for invoking workers. This WakeInfo
can be recovered from this context.
Note that our contexts are 'static
as they are maintained inside of the worker.
Implementations§
Source§impl WakeInfo
impl WakeInfo
Sourcepub unsafe fn from_context<'b>(context: &'b mut Context<'_>) -> &'b mut Self
pub unsafe fn from_context<'b>(context: &'b mut Context<'_>) -> &'b mut Self
Recover the WakeInfo from a given context.
§Safety
Although the lifetime of Context is 'static
, the generic type passed to Future
does not
specify a lifetime. As such, it is not possible for the future to store the Context, and
rescheduling must be specified before this Future invocation returns.
This does assume we are only using the Zephyr scheduler. The Context does have an any-based data pointer mechanism, but it is nightly. This recovery would be easier using that mechanism.
Sourcepub fn add_semaphore<'a>(&'a mut self, sem: &'a Semaphore)
pub fn add_semaphore<'a>(&'a mut self, sem: &'a Semaphore)
Add an event that represents waiting for a semaphore to be available for “take”.
Sourcepub fn add_signal<'a>(&'a mut self, signal: &'a Signal)
pub fn add_signal<'a>(&'a mut self, signal: &'a Signal)
Add an event that represents waiting for a signal.