Skip to main content

Module waker

Module waker 

Source
Expand description

Custom RawWakerVTable implementation.

Each Waker holds an Arc<TaskHeader> cast to a raw *const (). The four vtable functions implement the RawWaker contract:

functionaction
clone_wakerArc::clone — increments refcount
wakeschedule task, consume (decrement) Arc
wake_by_refschedule task, keep Arc alive
drop_wakerArc::from_raw then drop — decrements refcount

Safety contract: the data pointer is always a valid Arc<TaskHeader> that was created via Arc::into_raw. All four functions restore it to an Arc before performing any operation, maintaining the reference count correctly.