skyline/app/src/main/cpp/skyline/kernel/types/KSyncObject.cpp
PixelyIon fe5061a8e0 Address CR Comments (#132) + Change Core Migration API
This addresses all CR comments including more codebase-wide changes arising from certain review comments like proper usage of its/it's and consistent contraction of it is into it's. 

An overhaul was made to the presentation and formatting of `KThread.h` and `LoadBalance` works has been superseded by `GetOptimalCoreForThread` which can be used alongside `InsertThread` or `MigrateToCore`. It makes the API far more atomic and neater. This was a major point of contention for the design prior, it's simplified some code and potentially improved performance.
2021-03-05 14:55:34 +05:30

29 lines
792 B
C++

// SPDX-License-Identifier: MPL-2.0
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "KSyncObject.h"
#include "KThread.h"
namespace skyline::kernel::type {
void KSyncObject::Signal() {
std::lock_guard lock(syncObjectMutex);
signalled = true;
for (auto &waiter : syncObjectWaiters) {
if (waiter->isCancellable) {
waiter->isCancellable = false;
waiter->wakeObject = this;
state.scheduler->InsertThread(waiter);
}
}
}
bool KSyncObject::ResetSignal() {
std::lock_guard lock(syncObjectMutex);
if (signalled) [[likely]] {
signalled = false;
return true;
}
return false;
}
}