mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-06-18 16:28:47 +02:00
fe5061a8e0
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.
29 lines
792 B
C++
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;
|
|
}
|
|
}
|