mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
engine: improve atomic operations for turbo state management
This commit is contained in:
parent
1b31dd9e1e
commit
806cf64d29
1 changed files with 4 additions and 4 deletions
|
@ -219,9 +219,9 @@ fn manage_auto_turbo(report: &SystemReport, config: &ProfileConfig) -> Result<()
|
|||
};
|
||||
|
||||
// Get previous state safely using atomic operations
|
||||
let has_previous_state = TURBO_STATE_INITIALIZED.load(Ordering::Relaxed);
|
||||
let has_previous_state = TURBO_STATE_INITIALIZED.load(Ordering::Acquire);
|
||||
let previous_turbo_enabled = if has_previous_state {
|
||||
Some(PREVIOUS_TURBO_STATE.load(Ordering::Relaxed))
|
||||
Some(PREVIOUS_TURBO_STATE.load(Ordering::Acquire))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -272,8 +272,8 @@ fn manage_auto_turbo(report: &SystemReport, config: &ProfileConfig) -> Result<()
|
|||
};
|
||||
|
||||
// Save the current state for next time using atomic operations
|
||||
PREVIOUS_TURBO_STATE.store(enable_turbo, Ordering::Relaxed);
|
||||
TURBO_STATE_INITIALIZED.store(true, Ordering::Relaxed);
|
||||
PREVIOUS_TURBO_STATE.store(enable_turbo, Ordering::Release);
|
||||
TURBO_STATE_INITIALIZED.store(true, Ordering::Release);
|
||||
|
||||
// Apply the turbo setting
|
||||
let turbo_setting = if enable_turbo {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue