diff options
author | Stjepan Glavina <stjepang@gmail.com> | 2020-09-17 15:02:38 +0200 |
---|---|---|
committer | Stjepan Glavina <stjepang@gmail.com> | 2020-09-17 15:02:38 +0200 |
commit | e5d57b79466807554422e6a5146f0cd7fc131040 (patch) | |
tree | f948c049124af089263a0398c1f130fa9df5cd10 /src | |
parent | e17c3fc20e4f55aa830172e9e57f0d2e76b99a84 (diff) | |
download | async-task-e5d57b79466807554422e6a5146f0cd7fc131040.tar.gz |
Remove JoinHandle::waker
Diffstat (limited to 'src')
-rw-r--r-- | src/join_handle.rs | 13 | ||||
-rw-r--r-- | src/lib.rs | 6 | ||||
-rw-r--r-- | src/task.rs | 4 |
3 files changed, 6 insertions, 17 deletions
diff --git a/src/join_handle.rs b/src/join_handle.rs index e6dbdb8..487adf5 100644 --- a/src/join_handle.rs +++ b/src/join_handle.rs @@ -4,7 +4,7 @@ use core::marker::{PhantomData, Unpin}; use core::pin::Pin; use core::ptr::NonNull; use core::sync::atomic::Ordering; -use core::task::{Context, Poll, Waker}; +use core::task::{Context, Poll}; use crate::header::Header; use crate::state::*; @@ -80,17 +80,6 @@ impl<R> JoinHandle<R> { } } } - - /// Returns a waker associated with the task. - pub fn waker(&self) -> Waker { - let ptr = self.raw_task.as_ptr(); - let header = ptr as *const Header; - - unsafe { - let raw_waker = ((*header).vtable.clone_waker)(ptr); - Waker::from_raw(raw_waker) - } - } } impl<R> Drop for JoinHandle<R> { @@ -18,7 +18,7 @@ //! # let schedule = move |task| sender.send(task).unwrap(); //! # //! # // Construct a task. -//! # let (task, handle) = async_task::spawn(future, schedule, ()); +//! # let (task, handle) = async_task::spawn(future, schedule); //! ``` //! //! A task is constructed using either [`spawn`] or [`spawn_local`]: @@ -33,7 +33,7 @@ //! let schedule = move |task| sender.send(task).unwrap(); //! //! // Construct a task. -//! let (task, handle) = async_task::spawn(future, schedule, ()); +//! let (task, handle) = async_task::spawn(future, schedule); //! //! // Push the task into the queue by invoking its schedule function. //! task.schedule(); @@ -56,7 +56,7 @@ //! # let schedule = move |task| sender.send(task).unwrap(); //! # //! # // Construct a task. -//! # let (task, handle) = async_task::spawn(future, schedule, ()); +//! # let (task, handle) = async_task::spawn(future, schedule); //! # //! # // Push the task into the queue by invoking its schedule function. //! # task.schedule(); diff --git a/src/task.rs b/src/task.rs index 0507a90..10f9a34 100644 --- a/src/task.rs +++ b/src/task.rs @@ -45,7 +45,7 @@ use crate::JoinHandle; /// let schedule = move |task| s.send(task).unwrap(); /// /// // Create a task with the future and the schedule function. -/// let (task, handle) = async_task::spawn(future, schedule, ()); +/// let (task, handle) = async_task::spawn(future, schedule); /// ``` pub fn spawn<F, R, S>(future: F, schedule: S) -> (Task, JoinHandle<R>) where @@ -106,7 +106,7 @@ where /// let schedule = move |task| s.send(task).unwrap(); /// /// // Create a task with the future and the schedule function. -/// let (task, handle) = async_task::spawn_local(future, schedule, ()); +/// let (task, handle) = async_task::spawn_local(future, schedule); /// ``` #[cfg(feature = "std")] pub fn spawn_local<F, R, S>(future: F, schedule: S) -> (Task, JoinHandle<R>) |