aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStjepan Glavina <stjepang@gmail.com>2019-11-25 18:47:16 +0100
committerStjepan Glavina <stjepang@gmail.com>2019-11-25 18:47:16 +0100
commit951d9711f6144797c342bb1e47490fd79b372606 (patch)
treead6ab5280e29a410e0789d73ed45a74bbe6e4cbc /src
parentfcfa4ab885682a86c0b8aa951447cfd5f559cd25 (diff)
downloadasync-task-951d9711f6144797c342bb1e47490fd79b372606.tar.gz
Add an note about the schedule function
Diffstat (limited to 'src')
-rw-r--r--src/task.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/task.rs b/src/task.rs
index b12cace..83cdf79 100644
--- a/src/task.rs
+++ b/src/task.rs
@@ -19,6 +19,9 @@ use crate::JoinHandle;
/// When run, the task polls `future`. When woken up, it gets scheduled for running by the
/// `schedule` function. Argument `tag` is an arbitrary piece of data stored inside the task.
///
+/// The schedule function should not attempt to run the task nor to drop it. Instead, it should
+/// push the task into some kind of queue so that it can be processed later.
+///
/// If you need to spawn a future that does not implement [`Send`], consider using the
/// [`spawn_local`] function instead.
///
@@ -71,6 +74,9 @@ where
/// When run, the task polls `future`. When woken up, it gets scheduled for running by the
/// `schedule` function. Argument `tag` is an arbitrary piece of data stored inside the task.
///
+/// The schedule function should not attempt to run the task nor to drop it. Instead, it should
+/// push the task into some kind of queue so that it can be processed later.
+///
/// Unlike [`spawn`], this function does not require the future to implement [`Send`]. If the
/// [`Task`] reference is run or dropped on a thread it was not created on, a panic will occur.
///