Skip to content

Commit ef497d8

Browse files
GnomedDevRalfJung
andcommitted
More documentation improvements
Co-authored-by: Ralf Jung <[email protected]>
1 parent 34cd955 commit ef497d8

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
@@ -1290,7 +1290,9 @@ struct OtherInner {
12901290
/// The internal representation of a `Thread` handle.
12911291
#[derive(Clone)]
12921292
enum Inner {
1293+
/// Represents the main thread. May only be constructed by Thread::new_main.
12931294
Main,
1295+
/// Represents any other thread.
12941296
Other(Pin<Arc<OtherInner>>),
12951297
}
12961298

@@ -1372,9 +1374,10 @@ impl Thread {
13721374
/// This must only ever be called once, and must be called on the main thread.
13731375
pub(crate) unsafe fn new_main() -> Thread {
13741376
// Safety: As this is only called once and on the main thread, nothing else is accessing MAIN_PARKER
1375-
// as the only other read occurs after Inner::Main has been constructed, after this call finishes.
1377+
// as the only other read occurs in Inner::parker *after* Inner::Main has been constructed,
1378+
// and this function is the only one that constructs Inner::Main.
13761379
//
1377-
// Pre-main thread spawning cannot hit this either, as the caller holds that this is only called on the main thread.
1380+
// Pre-main thread spawning cannot hit this either, as the caller promises that this is only called on the main thread.
13781381
unsafe { Parker::new_in_place(MAIN_PARKER.get().cast()) }
13791382

13801383
Self(Inner::Main)

0 commit comments

Comments
 (0)