Kernel: Fix return value for {enable,disable}_profile_timer()
These functions should return success when being called when profiling has been requested from multiple callers because enabling/disabling the timer is a no-op in that case and thus didn't fail.
This commit is contained in:
parent
e0493c509e
commit
52a4a1ec75
Notes:
sideshowbarker
2024-07-18 17:55:21 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/52a4a1ec75b Pull-request: https://github.com/SerenityOS/serenity/pull/7212
1 changed files with 10 additions and 10 deletions
|
@ -402,20 +402,20 @@ void TimeManagement::system_timer_tick(const RegisterState& regs)
|
|||
|
||||
bool TimeManagement::enable_profile_timer()
|
||||
{
|
||||
if (m_profile_timer && m_profile_enable_count.fetch_add(1) == 0) {
|
||||
m_profile_timer->try_to_set_frequency(m_profile_timer->calculate_nearest_possible_frequency(OPTIMAL_PROFILE_TICKS_PER_SECOND_RATE));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (!m_profile_timer)
|
||||
return false;
|
||||
if (m_profile_enable_count.fetch_add(1) == 0)
|
||||
return m_profile_timer->try_to_set_frequency(m_profile_timer->calculate_nearest_possible_frequency(OPTIMAL_PROFILE_TICKS_PER_SECOND_RATE));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TimeManagement::disable_profile_timer()
|
||||
{
|
||||
if (m_profile_timer && m_profile_enable_count.fetch_sub(1) == 1) {
|
||||
m_profile_timer->try_to_set_frequency(m_profile_timer->calculate_nearest_possible_frequency(1));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (!m_profile_timer)
|
||||
return false;
|
||||
if (m_profile_enable_count.fetch_sub(1) == 1)
|
||||
return m_profile_timer->try_to_set_frequency(m_profile_timer->calculate_nearest_possible_frequency(1));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue