Skip to main content

Module queue

Module queue 

Source
Expand description

The work of a thread that owns some state: a Queue of tasks that take the state by &mut, posted from any thread and run by the owning thread in its turns.

A task can be posted to run as soon as the owner runs the queue, or once a deadline passes, and a timed task can be cancelled until it runs. A thread of its own runs the queue with Queue::run, which parks until a task arrives or the next deadline passes. A host that has its own loop, such as the browser’s pump, runs it with Queue::run_once instead, and learns of new work through the queue’s waker.

Structs§

Queue
A queue of tasks that take &mut S, which the thread that runs the queue owns. Cheap to clone: clones are handles to the same queue.
TimedTask
Names a timed task of a Queue, for Queue::cancel. Each one that a queue hands out names a task of its own, if any: a timed task that a closed queue got, or whose deadline never comes, has a key that names nothing.
WeakQueue
A handle to a Queue that doesn’t keep it alive: what it posts once the queue is gone drops.

Type Aliases§

Waker
What a queue calls, on the posting thread, when work arrives.