Skip to content

Commit 9cdbd09

Browse files
committed
Remove macro definition that's only used once
1 parent 0d5b969 commit 9cdbd09

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/threadpool.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ static TOTAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(0);
2828
static SPAWNS: AtomicUsize = AtomicUsize::new(0);
2929
static 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-
4231
type Work = Box<dyn FnOnce() + Send + 'static>;
4332

4433
struct 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(())

0 commit comments

Comments
 (0)