mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-11-23 03:09:55 +00:00
libraries/kernel: implement scePthreadSetPrio
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
This commit is contained in:
parent
b117eaadc4
commit
4e618499ce
@ -421,6 +421,32 @@ int PS4_SYSV_ABI scePthreadGetprio(PthreadT thread, int* priority) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI scePthreadSetprio(PthreadT thread, int prio) {
|
||||
SchedParam param;
|
||||
int ret;
|
||||
|
||||
param.sched_priority = prio;
|
||||
|
||||
auto* thread_state = ThrState::Instance();
|
||||
if (thread == g_curthread) {
|
||||
g_curthread->lock.lock();
|
||||
} else if (int ret = thread_state->FindThread(thread, /*include dead*/0)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (thread->attr.sched_policy == SchedPolicy::Other ||
|
||||
thread->attr.prio == prio) {
|
||||
thread->attr.prio = prio;
|
||||
ret = 0;
|
||||
} else {
|
||||
// TODO: _thr_setscheduler
|
||||
thread->attr.prio = prio;
|
||||
}
|
||||
|
||||
thread->lock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
enum class PthreadCancelState : u32 {
|
||||
Enable = 0,
|
||||
Disable = 1,
|
||||
@ -492,6 +518,7 @@ void RegisterThread(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("T72hz6ffq08", "libkernel", 1, "libkernel", 1, 1, posix_pthread_yield);
|
||||
LIB_FUNCTION("EI-5-jlq2dE", "libkernel", 1, "libkernel", 1, 1, posix_pthread_getthreadid_np);
|
||||
LIB_FUNCTION("1tKyG7RlMJo", "libkernel", 1, "libkernel", 1, 1, scePthreadGetprio);
|
||||
LIB_FUNCTION("W0Hpm2X0uPE", "libkernel", 1, "libkernel", 1, 1, scePthreadSetprio);
|
||||
LIB_FUNCTION("rNhWz+lvOMU", "libkernel", 1, "libkernel", 1, 1, _sceKernelSetThreadDtors);
|
||||
LIB_FUNCTION("6XG4B33N09g", "libkernel", 1, "libkernel", 1, 1, sched_yield);
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ DECLARE_ENUM_FLAG_OPERATORS(PthreadAttrFlags)
|
||||
|
||||
enum class SchedPolicy : u32 {
|
||||
Fifo = 0,
|
||||
Other = 2,
|
||||
RoundRobin = 3,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user