Skip to content

Commit 951d971

Browse files
author
Stjepan Glavina
committed
Add an note about the schedule function
1 parent fcfa4ab commit 951d971

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/task.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ use crate::JoinHandle;
1919
/// When run, the task polls `future`. When woken up, it gets scheduled for running by the
2020
/// `schedule` function. Argument `tag` is an arbitrary piece of data stored inside the task.
2121
///
22+
/// The schedule function should not attempt to run the task nor to drop it. Instead, it should
23+
/// push the task into some kind of queue so that it can be processed later.
24+
///
2225
/// If you need to spawn a future that does not implement [`Send`], consider using the
2326
/// [`spawn_local`] function instead.
2427
///
@@ -71,6 +74,9 @@ where
7174
/// When run, the task polls `future`. When woken up, it gets scheduled for running by the
7275
/// `schedule` function. Argument `tag` is an arbitrary piece of data stored inside the task.
7376
///
77+
/// The schedule function should not attempt to run the task nor to drop it. Instead, it should
78+
/// push the task into some kind of queue so that it can be processed later.
79+
///
7480
/// Unlike [`spawn`], this function does not require the future to implement [`Send`]. If the
7581
/// [`Task`] reference is run or dropped on a thread it was not created on, a panic will occur.
7682
///

0 commit comments

Comments
 (0)