diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/futures-0.1.29/src/task.rs | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/futures-0.1.29/src/task.rs')
-rw-r--r-- | third_party/rust/futures-0.1.29/src/task.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/third_party/rust/futures-0.1.29/src/task.rs b/third_party/rust/futures-0.1.29/src/task.rs new file mode 100644 index 0000000000..f83f2c4719 --- /dev/null +++ b/third_party/rust/futures-0.1.29/src/task.rs @@ -0,0 +1,46 @@ +//! Tasks used to drive a future computation +//! +//! It's intended over time a particular operation (such as servicing an HTTP +//! request) will involve many futures. This entire operation, however, can be +//! thought of as one unit, as the entire result is essentially just moving +//! through one large state machine. +//! +//! A "task" is the unit of abstraction for what is driving this state machine +//! and tree of futures forward. A task is used to poll futures and schedule +//! futures with, and has utilities for sharing data between tasks and handles +//! for notifying when a future is ready. Each task also has its own set of +//! task-local data generated by `task_local!`. +//! +//! Note that libraries typically should not manage tasks themselves, but rather +//! leave that to event loops and other "executors" (see the `executor` module), +//! or by using the `wait` method to create and execute a task directly on the +//! current thread. +//! +//! More information about the task model can be found [online at tokio.rs]. +//! +//! [online at tokio.rs]: https://tokio.rs/docs/going-deeper-futures/futures-model/ +//! +//! ## Functions +//! +//! There is an important bare function in this module: `current`. The +//! `current` function returns a handle to the currently running task, panicking +//! if one isn't present. This handle is then used to later notify the task that +//! it's ready to make progress through the `Task::notify` method. + +#[doc(hidden)] +#[deprecated(since = "0.1.4", note = "import through the executor module instead")] +#[cfg(all(feature = "with-deprecated", feature = "use_std"))] +#[allow(deprecated)] +pub use task_impl::{Spawn, spawn, Unpark, Executor, Run, park}; + +pub use task_impl::{Task, AtomicTask, current, init, is_in_task}; + +#[allow(deprecated)] +#[cfg(feature = "use_std")] +pub use task_impl::{LocalKey, with_unpark_event, UnparkEvent, EventSet}; + +#[doc(hidden)] +#[deprecated(since = "0.1.4", note = "import through the executor module instead")] +#[cfg(all(feature = "with-deprecated", feature = "use_std"))] +#[allow(deprecated)] +pub use task_impl::TaskRc; |