[−][src]Module sunrise_libuser::futures
Futures Executor
A WaitableManager is a future executor, which is more or less a userspace scheduler, taking a list of Task and running them to completion. Occasionally, a Task will need to wait on a resource, usually backed by a Handle. When this happens, it can use its core::task::Waker to tell the executor to wake it up once a specified handled is notified.
A WorkQueue is a handle to the WaitableManager. Work is submitted to the WaitableManager by pushing WorkItems on the WorkQueue.
The implementation is very liberally taken from the blog post Building an Embedded Futures Executor and adapted to work with the current Futures API and to work with our Operating System.
Structs
QueueWaker | A waker backed by a WorkQueue and an index in the WaitableManager's registry of tasks. Waking up will add a Poll work item on the WorkQueue, causing the WaitableManager to poll the item selected by the index. |
SimpleWorkQueue | A variant of a WorkQueue that can only push WaitHandle/UnregisterHandle/Poll tasks. |
Task | A Task represents a future spawned on the WaitableManager. |
WaitableManager | The event loop manager. Waits on the waitable objects added to it. |
WorkQueue | A WorkQueue represents a handle to a WaitableManager on which you can spawn new Futures with WorkQueue::spawn() or put the current future to sleep until a handle is signaled through HandleRef::wait_async(). |
Enums
WorkItem | A WorkItem is an element of work that will be executed by a WaitableManager's run function. By pushing a new WorkItem on a WorkQueue, the user can drive the event loop. |
Statics
CURRENT_TASK | Task currently executing on this thread, or None. |