Skip to content

Commit

Permalink
Check active even if Condvar times out in PeriodicWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Feb 5, 2024
1 parent dfca4a8 commit 8b386c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spdlog/src/periodic_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ impl PeriodicWorker {
active: active.clone(),
thread: Some(thread::spawn(move || loop {
let guard = active.0.lock_expect();
let (_, res) = active
let (guard, res) = active
.1
.wait_timeout_while(guard, interval, |active| *active)
.unwrap();

if !res.timed_out() || !callback() {
if !res.timed_out() || !*guard || !callback() {
return;
}
})),
Expand Down

0 comments on commit 8b386c2

Please sign in to comment.