File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,8 @@ impl WorkersInfo for u64 {
8989 }
9090}
9191
92- const BACKUP_THRESHOLD : i64 = 64 ;
92+ const BACKUP_TO_ACTIVE_THRESHOLD : i64 = -16 ;
93+ const ACTIVE_TO_BACKUP_THRESHOLD : i64 = 128 ;
9394
9495/// The core of queues.
9596///
@@ -135,7 +136,7 @@ impl<T> QueueCore<T> {
135136 self . backup_count . store ( 0 , Ordering :: SeqCst ) ;
136137 } else {
137138 backup_count = self . backup_count . fetch_sub ( 1 , Ordering :: SeqCst ) - 1 ;
138- while backup_count < - BACKUP_THRESHOLD {
139+ while backup_count < BACKUP_TO_ACTIVE_THRESHOLD {
139140 match self . backup_count . compare_exchange_weak (
140141 backup_count,
141142 0 ,
@@ -180,7 +181,7 @@ impl<T> QueueCore<T> {
180181 pub fn park_to_backup ( & self ) -> bool {
181182 let mut v = self . backup_count . load ( Ordering :: SeqCst ) ;
182183 loop {
183- if v < BACKUP_THRESHOLD {
184+ if v < ACTIVE_TO_BACKUP_THRESHOLD {
184185 return false ;
185186 }
186187 match self
You can’t perform that action at this time.
0 commit comments