about summary refs log tree commit diff
path: root/src/libstd/thread/mod.rs
diff options
context:
space:
mode:
authorcsmoe <csmoe@msn.com>2020-05-18 08:46:24 +0800
committercsmoe <csmoe@msn.com>2020-05-19 11:02:29 +0800
commit2f311b07c8d95b1192e585e983535de89bcbdfaa (patch)
tree0e12c995dfdd9352eaa61d542c6f604aca23b456 /src/libstd/thread/mod.rs
parent8841ede3648b5f12284dae850ec065374fd3af46 (diff)
parentd79f1bd31a1401b5d08096fcdf9a9eb23ddf95df (diff)
downloadrust-2f311b07c8d95b1192e585e983535de89bcbdfaa.tar.gz
rust-2f311b07c8d95b1192e585e983535de89bcbdfaa.zip
Merge branch 'master' into issue-69276
Diffstat (limited to 'src/libstd/thread/mod.rs')
-rw-r--r--src/libstd/thread/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 7a3cbbe4562..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
@@ -1272,7 +1276,7 @@ impl Thread {
     }
 
     fn cname(&self) -> Option<&CStr> {
-        self.inner.name.as_ref().map(|s| &**s)
+        self.inner.name.as_deref()
     }
 }