Browse Source

Use the new way of getting the priority value

pull/46/head
AzureMarker 3 years ago
parent
commit
e891b8839b
No known key found for this signature in database
GPG Key ID: 47A133F3BF9D03D3
  1. 8
      ctru-rs/src/thread.rs

8
ctru-rs/src/thread.rs

@ -27,7 +27,13 @@ use ctru_sys::svcGetProcessorID; @@ -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.

Loading…
Cancel
Save