Skip to content

Commit 0cd4b46

Browse files
GnomedDevRalfJung
andcommitted
More documentation improvements
Co-authored-by: Ralf Jung <[email protected]>
1 parent 3833c67 commit 0cd4b46

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

library/std/src/thread/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,9 @@ struct OtherInner {
12961296
/// The internal representation of a `Thread` handle.
12971297
#[derive(Clone)]
12981298
enum Inner {
1299+
/// Represents the main thread. May only be constructed by Thread::new_main.
12991300
Main,
1301+
/// Represents any other thread.
13001302
Other(Pin<Arc<OtherInner>>),
13011303
}
13021304

@@ -1378,9 +1380,10 @@ impl Thread {
13781380
/// This must only ever be called once, and must be called on the main thread.
13791381
pub(crate) unsafe fn new_main() -> Thread {
13801382
// Safety: As this is only called once and on the main thread, nothing else is accessing MAIN_PARKER
1381-
// as the only other read occurs after Inner::Main has been constructed, after this call finishes.
1383+
// as the only other read occurs in Inner::parker *after* Inner::Main has been constructed,
1384+
// and this function is the only one that constructs Inner::Main.
13821385
//
1383-
// Pre-main thread spawning cannot hit this either, as the caller holds that this is only called on the main thread.
1386+
// Pre-main thread spawning cannot hit this either, as the caller promises that this is only called on the main thread.
13841387
unsafe { Parker::new_in_place(MAIN_PARKER.get().cast()) }
13851388

13861389
Self(Inner::Main)

0 commit comments

Comments
 (0)