about summary refs log tree commit diff
path: root/library/std/src/lib.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-11-25 00:39:03 +0800
committerGitHub <noreply@github.com>2024-11-25 00:39:03 +0800
commit31b4023e24e82c7c0ca6b9637de1b14d46d02b92 (patch)
tree6151658caf22a6b98e10c622d684094c5492fdc6 /library/std/src/lib.rs
parentf5d18576856ef45d1e47de79889ae7db9d1afa29 (diff)
parent5a856b82f3a1bf335e0e62d92c800d8436977af1 (diff)
downloadrust-31b4023e24e82c7c0ca6b9637de1b14d46d02b92.tar.gz
rust-31b4023e24e82c7c0ca6b9637de1b14d46d02b92.zip
Rollup merge of #132730 - joboet:after_main_sync, r=Noratrieb
std: allow after-main use of synchronization primitives

By creating an unnamed thread handle when the actual one has already been destroyed, synchronization primitives using thread parking can be used even outside the Rust runtime.

This also fixes an inefficiency in the queue-based `RwLock`: if `thread::current` was not initialized yet, it will create a new handle on every parking attempt without initializing `thread::current`. The private `current_or_unnamed` function introduced here fixes this.
Diffstat (limited to 'library/std/src/lib.rs')
-rw-r--r--library/std/src/lib.rs3
1 files changed, 0 insertions, 3 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index b6723c6dfa5..ee6fceb024f 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -174,9 +174,6 @@
 //!
 //! - after-main use of thread-locals, which also affects additional features:
 //!   - [`thread::current()`]
-//!   - [`thread::scope()`]
-//!   - [`sync::mpmc`]
-//!   - [`sync::mpsc`]
 //! - before-main stdio file descriptors are not guaranteed to be open on unix platforms
 //!
 //!