skyline/app/src/main/cpp/skyline/kernel/types/KSyncObject.cpp
◱ PixelyIon 7ad2e11705 Milestone 3 - Services API
This commit adds the Services API and implements some services. It also changes the name of the application to Skyline and replaces the icon.
2019-09-25 02:28:25 +05:30

22 lines
918 B
C++

#include "KSyncObject.h"
#include "../../os.h"
namespace skyline::kernel::type {
KSyncObject::KSyncObject(skyline::handle_t handle, pid_t pid, const skyline::DeviceState &state, skyline::kernel::type::KType type) : KObject(handle, pid, state, type) {}
void KSyncObject::Signal() {
for (auto&[tid, process] : state.os->threadMap) {
auto &thread = process->threadMap.at(tid);
if (thread->status == type::KThread::ThreadStatus::Waiting) {
for (auto &waitHandle : thread->waitHandles) {
if (handle == waitHandle) {
thread->status = type::KThread::ThreadStatus::Runnable;
state.nce->SetRegister(Wreg::W0, constant::status::Success, thread->pid);
state.nce->SetRegister(Wreg::W1, handle, thread->pid);
}
}
}
}
}
}