Skip to content

Commit

Permalink
fix: Cancel pending timer timeout before disabling/enabling timer
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualEhrmanntraut committed Nov 27, 2024
1 parent 1b540f1 commit 023971b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ForgedInvariant/ForgedInvariant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@ void ForgedInvariantMain::wrapTracePoint(void *that, UInt8 point) {
case kIOPMTracePointSleepCPUs: // Those CPUs sure like to sleep.
atomic_store_explicit(&singleton().systemAwake, false, memory_order_relaxed);
atomic_store_explicit(&singleton().synchronised, false, memory_order_relaxed);
if (singleton().syncTimer != nullptr) { singleton().syncTimer->disable(); }
if (singleton().syncTimer != nullptr) {
singleton().syncTimer->cancelTimeout();
singleton().syncTimer->disable();
}
break;
case kIOPMTracePointWakePlatformActions: // So now you want to wake up, huh?
atomic_store_explicit(&singleton().systemAwake, true, memory_order_relaxed);
singleton().syncTsc();
if (singleton().syncTimer != nullptr) {
singleton().syncTimer->cancelTimeout();
singleton().syncTimer->enable();
singleton().syncTimer->setTimeoutMS(PERIODIC_SYNC_INTERVAL);
}
Expand Down

0 comments on commit 023971b

Please sign in to comment.