Change driver thread store into compare/exchange

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2023-10-09 20:25:07 -07:00
parent f6dac9af91
commit 9bce9de45b
No known key found for this signature in database
GPG Key ID: 397D2B00FEA368AA
1 changed files with 3 additions and 1 deletions

View File

@ -158,7 +158,9 @@ impl Reaper {
#[cold]
fn start_driver_thread(&'static self) {
#[cfg(test)]
DRIVER_THREAD_SPAWNED.store(true, Ordering::SeqCst);
DRIVER_THREAD_SPAWNED
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
.unwrap_or_else(|_| unreachable!("Driver thread already spawned"));
thread::Builder::new()
.name("async-process".to_string())