| 1 |
//! Tools for working with tasks. |
| 2 |
//! |
| 3 |
//! This module contains: |
| 4 |
//! |
| 5 |
//! - [`Spawn`], a trait for spawning new tasks. |
| 6 |
//! - [`Context`], a context of an asynchronous task, |
| 7 |
//! including a handle for waking up the task. |
| 8 |
//! - [`Waker`], a handle for waking up a task. |
| 9 |
//! |
| 10 |
//! The remaining types and traits in the module are used for implementing |
| 11 |
//! executors or dealing with synchronization issues around task wakeup. |
| 12 |
|
| 13 |
#[doc(no_inline)] |
| 14 |
pub use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; |
| 15 |
|
| 16 |
#[cfg(all(feature = "alloc", target_has_atomic = "ptr"))] |
| 17 |
#[doc(no_inline)] |
| 18 |
pub use alloc::task::Wake; |
| 19 |
|
| 20 |
pub use futures_task::{FutureObj, LocalFutureObj, LocalSpawn, Spawn, SpawnError, UnsafeFutureObj}; |
| 21 |
|
| 22 |
pub use futures_task::noop_waker; |
| 23 |
pub use futures_task::noop_waker_ref; |
| 24 |
|
| 25 |
#[cfg(target_has_atomic = "ptr")] |
| 26 |
#[cfg(feature = "alloc")] |
| 27 |
pub use futures_task::ArcWake; |
| 28 |
|
| 29 |
#[cfg(target_has_atomic = "ptr")] |
| 30 |
#[cfg(feature = "alloc")] |
| 31 |
pub use futures_task::waker; |
| 32 |
|
| 33 |
#[cfg(target_has_atomic = "ptr")] |
| 34 |
#[cfg(feature = "alloc")] |
| 35 |
pub use futures_task::{waker_ref, WakerRef}; |
| 36 |
|
| 37 |
#[cfg(any(target_has_atomic = "ptr", feature = "portable-atomic"))] |
| 38 |
pub use futures_core::task::__internal::AtomicWaker; |
| 39 |
|
| 40 |
mod spawn; |
| 41 |
pub use self::spawn::{LocalSpawnExt, SpawnExt}; |