about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2020-05-12 16:38:02 +0100
committerKornel <kornel@geekhood.net>2020-05-12 16:38:02 +0100
commit2d39f5abcd3953eb1578f718c75c39c457bcb009 (patch)
treee2538406011c830ea0f1cf606ff5f877135dbf5c /src/libstd/thread
parentd903a9def4c29846ec6215ccc7fa76d39428f577 (diff)
downloadrust-2d39f5abcd3953eb1578f718c75c39c457bcb009.tar.gz
rust-2d39f5abcd3953eb1578f718c75c39c457bcb009.zip
Warn against thread::sleep in async fn
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 738f07250b5..3134a596756 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -737,6 +737,8 @@ pub fn panicking() -> bool {
 /// The thread may sleep longer than the duration specified due to scheduling
 /// specifics or platform-dependent functionality. It will never sleep less.
 ///
+/// This function is blocking, and should not be used in `async` functions.
+///
 /// # Platform-specific behavior
 ///
 /// On Unix platforms, the underlying syscall may be interrupted by a
@@ -763,6 +765,8 @@ pub fn sleep_ms(ms: u32) {
 /// The thread may sleep longer than the duration specified due to scheduling
 /// specifics or platform-dependent functionality. It will never sleep less.
 ///
+/// This function is blocking, and should not be used in `async` functions.
+///
 /// # Platform-specific behavior
 ///
 /// On Unix platforms, the underlying syscall may be interrupted by a