Use scoped_lock, etc

This commit is contained in:
TuxSH
2018-11-05 14:12:38 +01:00
committed by Michael Scire
parent 698fa9fcb0
commit cd1f74154d
7 changed files with 21 additions and 21 deletions

View File

@@ -8,7 +8,7 @@ namespace mesosphere
void KAlarm::AddAlarmable(IAlarmable &alarmable)
{
std::lock_guard guard{spinlock};
std::scoped_lock guard{spinlock};
alarmables.insert(alarmable);
KSystemClock::SetAlarm(alarmables.cbegin()->GetAlarmTime());
@@ -16,7 +16,7 @@ void KAlarm::AddAlarmable(IAlarmable &alarmable)
void KAlarm::RemoveAlarmable(const IAlarmable &alarmable)
{
std::lock_guard guard{spinlock};
std::scoped_lock guard{spinlock};
alarmables.erase(alarmable);
KSystemClock::SetAlarm(alarmables.cbegin()->GetAlarmTime());
@@ -26,8 +26,8 @@ void KAlarm::HandleAlarm()
{
{
KCriticalSection &critsec = KScheduler::GetCriticalSection();
std::lock_guard criticalSection{critsec};
std::lock_guard guard{spinlock};
std::scoped_lock criticalSection{critsec};
std::scoped_lock guard{spinlock};
KSystemClock::SetInterruptMasked(true); // mask timer interrupt
KSystemClock::time_point currentTime = KSystemClock::now(), maxAlarmTime;