From e891b8839bae4abc807cae030d4a296967a2b09b Mon Sep 17 00:00:00 2001 From: AzureMarker Date: Sat, 12 Feb 2022 21:07:47 -0800 Subject: [PATCH] Use the new way of getting the priority value --- ctru-rs/src/thread.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ctru-rs/src/thread.rs b/ctru-rs/src/thread.rs index 526ed6e..9eef8f1 100644 --- a/ctru-rs/src/thread.rs +++ b/ctru-rs/src/thread.rs @@ -27,7 +27,13 @@ use ctru_sys::svcGetProcessorID; /// Get the current thread's priority level. Lower values correspond to higher /// priority levels. The main thread's priority is typically 0x30, but not always. pub fn priority() -> i32 { - unsafe { libc::pthread_getpriority() } + let thread_id = unsafe { libc::pthread_self() }; + let mut policy = 0; + let mut sched_param = libc::sched_param { sched_priority: 0 }; + + unsafe { libc::pthread_getschedparam(thread_id, &mut policy, &mut sched_param) }; + + sched_param.sched_priority } /// Returns the ID of the processor the current thread is running on.