Skip to content

Commit 8cc76c1

Browse files
committed
Check active even if Condvar times out in PeriodicWorker (#61)
1 parent 3ccb14e commit 8cc76c1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spdlog/src/periodic_worker.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ impl PeriodicWorker {
2121
Self {
2222
active: active.clone(),
2323
thread: Some(thread::spawn(move || loop {
24-
let guard = active.0.lock_expect();
25-
let (_, res) = active
24+
let flag = active.0.lock_expect();
25+
let (flag, res) = active
2626
.1
27-
.wait_timeout_while(guard, interval, |active| *active)
27+
.wait_timeout_while(flag, interval, |flag| *flag)
2828
.unwrap();
2929

30-
if !res.timed_out() || !callback() {
30+
if !res.timed_out() || !*flag || !callback() {
3131
return;
3232
}
3333
})),

0 commit comments

Comments
 (0)