@@ -20,26 +20,26 @@ pub struct Scope<'env> {
2020pub struct ScopedJoinHandle < ' scope , T > ( JoinInner < ' scope , T > ) ;
2121
2222pub ( super ) struct ScopeData {
23- n_running_threads : AtomicUsize ,
23+ num_running_threads : AtomicUsize ,
2424 a_thread_panicked : AtomicBool ,
2525 main_thread : Thread ,
2626}
2727
2828impl ScopeData {
29- pub ( super ) fn increment_n_running_threads ( & self ) {
29+ pub ( super ) fn increment_num_running_threads ( & self ) {
3030 // We check for 'overflow' with usize::MAX / 2, to make sure there's no
3131 // chance it overflows to 0, which would result in unsoundness.
32- if self . n_running_threads . fetch_add ( 1 , Ordering :: Relaxed ) > usize:: MAX / 2 {
32+ if self . num_running_threads . fetch_add ( 1 , Ordering :: Relaxed ) > usize:: MAX / 2 {
3333 // This can only reasonably happen by mem::forget()'ing many many ScopedJoinHandles.
34- self . decrement_n_running_threads ( false ) ;
34+ self . decrement_num_running_threads ( false ) ;
3535 panic ! ( "too many running threads in thread scope" ) ;
3636 }
3737 }
38- pub ( super ) fn decrement_n_running_threads ( & self , panic : bool ) {
38+ pub ( super ) fn decrement_num_running_threads ( & self , panic : bool ) {
3939 if panic {
4040 self . a_thread_panicked . store ( true , Ordering :: Relaxed ) ;
4141 }
42- if self . n_running_threads . fetch_sub ( 1 , Ordering :: Release ) == 1 {
42+ if self . num_running_threads . fetch_sub ( 1 , Ordering :: Release ) == 1 {
4343 self . main_thread . unpark ( ) ;
4444 }
4545 }
9898{
9999 let scope = Scope {
100100 data : ScopeData {
101- n_running_threads : AtomicUsize :: new ( 0 ) ,
101+ num_running_threads : AtomicUsize :: new ( 0 ) ,
102102 main_thread : current ( ) ,
103103 a_thread_panicked : AtomicBool :: new ( false ) ,
104104 } ,
@@ -109,7 +109,7 @@ where
109109 let result = catch_unwind ( AssertUnwindSafe ( || f ( & scope) ) ) ;
110110
111111 // Wait until all the threads are finished.
112- while scope. data . n_running_threads . load ( Ordering :: Acquire ) != 0 {
112+ while scope. data . num_running_threads . load ( Ordering :: Acquire ) != 0 {
113113 park ( ) ;
114114 }
115115
@@ -287,7 +287,7 @@ impl<'scope, T> ScopedJoinHandle<'scope, T> {
287287impl < ' env > fmt:: Debug for Scope < ' env > {
288288 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
289289 f. debug_struct ( "Scope" )
290- . field ( "n_running_threads " , & self . data . n_running_threads . load ( Ordering :: Relaxed ) )
290+ . field ( "num_running_threads " , & self . data . num_running_threads . load ( Ordering :: Relaxed ) )
291291 . field ( "a_thread_panicked" , & self . data . a_thread_panicked )
292292 . field ( "main_thread" , & self . data . main_thread )
293293 . finish_non_exhaustive ( )
0 commit comments