Remove JoinHandle::waker
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::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 @@
}
}
}
-
- /// 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> {
diff --git a/src/lib.rs b/src/lib.rs
index 9f7ba85..e3a979a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 @@
/// 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 @@
/// 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>)
diff --git a/tests/basic.rs b/tests/basic.rs
index 818f5f5..6f4357c 100644
--- a/tests/basic.rs
+++ b/tests/basic.rs
@@ -299,9 +299,7 @@
let task = r.recv().unwrap();
task.run();
- handle.waker().wake();
-
- r.recv().unwrap();
+ assert!(r.is_empty());
}
#[test]