File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -100,12 +100,12 @@ fn create_blocking_thread() {
100100 . spawn ( move || {
101101 let wait_limit = Duration :: from_millis ( 1000 + rand_sleep_ms) ;
102102
103- CURRENT_POOL_SIZE . fetch_add ( 1 , Ordering :: Relaxed ) ;
103+ CURRENT_POOL_SIZE . fetch_add ( 1 , Ordering :: SeqCst ) ;
104104 while let Ok ( task) = POOL . receiver . recv_timeout ( wait_limit) {
105105 abort_on_panic ( || task. run ( ) ) ;
106106 calculate_dispatch_frequency ( ) ;
107107 }
108- CURRENT_POOL_SIZE . fetch_sub ( 1 , Ordering :: Relaxed ) ;
108+ CURRENT_POOL_SIZE . fetch_sub ( 1 , Ordering :: SeqCst ) ;
109109 } )
110110 . expect ( "cannot start a dynamic thread driving blocking tasks" ) ;
111111}
@@ -123,7 +123,7 @@ fn schedule(t: async_task::Task<()>) {
123123 // expected pool size is above the MAX_THREADS (which is a
124124 // case won't happen)
125125 let pool_size = EXPECTED_POOL_SIZE . load ( Ordering :: Relaxed ) ;
126- let current_pool_size = CURRENT_POOL_SIZE . load ( Ordering :: Relaxed ) ;
126+ let current_pool_size = CURRENT_POOL_SIZE . load ( Ordering :: SeqCst ) ;
127127 let reward = ( AVR_FREQUENCY . load ( Ordering :: Relaxed ) as f64 / 2.0_f64 ) as u64 ;
128128
129129 if pool_size > current_pool_size && pool_size <= MAX_THREADS {
You can’t perform that action at this time.
0 commit comments