Use scoped_lock, etc
This commit is contained in:
@@ -10,7 +10,7 @@ void KConditionVariable::wait_until_impl(const KSystemClock::time_point &timeout
|
||||
// Official kernel counts number of waiters, but that isn't necessary
|
||||
{
|
||||
KThread *currentThread = KCoreContext::GetCurrentInstance().GetCurrentThread();
|
||||
std::lock_guard guard{KScheduler::GetCriticalSection()};
|
||||
KScopedCriticalSection criticalSection{};
|
||||
mutex_.unlock();
|
||||
if (currentThread->WaitForKernelSync(waiterList)) {
|
||||
(void)timeoutPoint; //TODO!
|
||||
@@ -23,7 +23,7 @@ void KConditionVariable::wait_until_impl(const KSystemClock::time_point &timeout
|
||||
|
||||
void KConditionVariable::notify_one() noexcept
|
||||
{
|
||||
std::lock_guard guard{KScheduler::GetCriticalSection()};
|
||||
KScopedCriticalSection criticalSection{};
|
||||
auto t = waiterList.begin();
|
||||
if (t != waiterList.end()) {
|
||||
t->ResumeFromKernelSync();
|
||||
@@ -32,7 +32,7 @@ void KConditionVariable::notify_one() noexcept
|
||||
|
||||
void KConditionVariable::notify_all() noexcept
|
||||
{
|
||||
std::lock_guard guard{KScheduler::GetCriticalSection()};
|
||||
KScopedCriticalSection criticalSection{};
|
||||
KThread::ResumeAllFromKernelSync(waiterList);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ void KMutex::lock_slow_path(KThread &owner, KThread &requester)
|
||||
{
|
||||
// Requester is currentThread most of (all ?) the time
|
||||
KCriticalSection &critsec = KScheduler::GetCriticalSection();
|
||||
std::lock_guard criticalSection{critsec};
|
||||
std::scoped_lock criticalSection{critsec};
|
||||
if (KCoreContext::GetCurrentInstance().GetScheduler()->IsActive()) {
|
||||
requester.SetWantedMutex((uiptr)this);
|
||||
owner.AddMutexWaiter(requester);
|
||||
|
||||
@@ -32,7 +32,7 @@ void KThread::AdjustScheduling(ushort oldMaskFull)
|
||||
|
||||
void KThread::Reschedule(KThread::SchedulingStatus newStatus)
|
||||
{
|
||||
//std::lock_guard criticalSection{KScheduler::GetCriticalSection()};
|
||||
//KScopedCriticalSection criticalSection{};
|
||||
// TODO check the above ^
|
||||
AdjustScheduling(SetSchedulingStatusField(newStatus));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user