File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -23,15 +23,11 @@ bool ADDPR(debugEnabled) = false;
23
23
uint32_t ADDPR (debugPrintDelay) = 0;
24
24
25
25
void SMCSuperIO::timerCallback () {
26
- auto time = getCurrentTimeNs ();
27
- auto timerDelta = time - timerEventLastTime;
28
26
dataSource->update ();
29
27
// timerEventSource->setTimeoutMS calls thread_call_enter_delayed_with_leeway, which spins.
30
28
// If the previous one was too long ago, schedule another one for differential recalculation!
31
- if (timerDelta > MaxDeltaForRescheduleNs)
32
- timerEventScheduled = timerEventSource->setTimeoutMS (TimerTimeoutMs) == kIOReturnSuccess ;
33
- else
34
- timerEventScheduled = false ;
29
+ timerEventSource->setTimeoutMS (TimerTimeoutMs);
30
+ atomic_flag_clear_explicit (&timerEventScheduled, memory_order_release);
35
31
}
36
32
37
33
IOService *SMCSuperIO::probe (IOService *provider, SInt32 *score) {
@@ -101,9 +97,9 @@ bool SMCSuperIO::start(IOService *provider) {
101
97
}
102
98
103
99
void SMCSuperIO::quickReschedule () {
104
- if (!timerEventScheduled) {
100
+ if (!atomic_flag_test_and_set_explicit (& timerEventScheduled, memory_order_acquire) ) {
105
101
// Make it 10 times faster
106
- timerEventScheduled = timerEventSource->setTimeoutMS (TimerTimeoutMs/10 ) == kIOReturnSuccess ;
102
+ timerEventSource->setTimeoutMS (TimerTimeoutMs/10 );
107
103
}
108
104
}
109
105
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class EXPORT SMCSuperIO : public IOService {
102
102
/* *
103
103
* Timer scheduling status
104
104
*/
105
- bool timerEventScheduled { false };
105
+ atomic_flag timerEventScheduled = { };
106
106
107
107
/* *
108
108
* Refresh sensor state on timer basis
You can’t perform that action at this time.
0 commit comments