File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1296,7 +1296,9 @@ struct OtherInner {
1296
1296
/// The internal representation of a `Thread` handle.
1297
1297
#[ derive( Clone ) ]
1298
1298
enum Inner {
1299
+ /// Represents the main thread. May only be constructed by Thread::new_main.
1299
1300
Main ,
1301
+ /// Represents any other thread.
1300
1302
Other ( Pin < Arc < OtherInner > > ) ,
1301
1303
}
1302
1304
@@ -1378,9 +1380,10 @@ impl Thread {
1378
1380
/// This must only ever be called once, and must be called on the main thread.
1379
1381
pub ( crate ) unsafe fn new_main ( ) -> Thread {
1380
1382
// 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.
1382
1385
//
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.
1384
1387
unsafe { Parker :: new_in_place ( MAIN_PARKER . get ( ) . cast ( ) ) }
1385
1388
1386
1389
Self ( Inner :: Main )
You can’t perform that action at this time.
0 commit comments