File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -28,17 +28,6 @@ static TOTAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(0);
2828static SPAWNS : AtomicUsize = AtomicUsize :: new ( 0 ) ;
2929static SPAWNING : AtomicBool = AtomicBool :: new ( false ) ;
3030
31- macro_rules! once {
32- ( $args: block) => {
33- #[ allow( clippy:: items_after_statements) ]
34- static __E: AtomicBool = AtomicBool :: new( false ) ;
35- if !__E. compare_and_swap( false , true , Relaxed ) {
36- // only execute this once
37- $args;
38- }
39- } ;
40- }
41-
4231type Work = Box < dyn FnOnce ( ) + Send + ' static > ;
4332
4433struct Queue {
@@ -189,13 +178,17 @@ fn spawn_new_thread(is_immortal: bool) -> Result<()> {
189178 } ) ;
190179
191180 if let Err ( e) = spawn_res {
181+ static E : AtomicBool = AtomicBool :: new ( false ) ;
182+
192183 SPAWNING . store ( false , SeqCst ) ;
193- once ! ( {
184+
185+ if !E . compare_and_swap ( false , true , Relaxed ) {
186+ // only execute this once
194187 warn ! (
195188 "Failed to dynamically increase the threadpool size: {:?}." ,
196189 e,
197190 )
198- } ) ;
191+ }
199192 }
200193
201194 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments