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 @@ -1290,7 +1290,9 @@ struct OtherInner {
1290
1290
/// The internal representation of a `Thread` handle.
1291
1291
#[ derive( Clone ) ]
1292
1292
enum Inner {
1293
+ /// Represents the main thread. May only be constructed by Thread::new_main.
1293
1294
Main ,
1295
+ /// Represents any other thread.
1294
1296
Other ( Pin < Arc < OtherInner > > ) ,
1295
1297
}
1296
1298
@@ -1372,9 +1374,10 @@ impl Thread {
1372
1374
/// This must only ever be called once, and must be called on the main thread.
1373
1375
pub ( crate ) unsafe fn new_main ( ) -> Thread {
1374
1376
// 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.
1376
1379
//
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.
1378
1381
unsafe { Parker :: new_in_place ( MAIN_PARKER . get ( ) . cast ( ) ) }
1379
1382
1380
1383
Self ( Inner :: Main )
You can’t perform that action at this time.
0 commit comments