From ac68bf099d915b95646736e4e9fba8fc7b1eef17 Mon Sep 17 00:00:00 2001 From: AzureMarker Date: Sat, 12 Feb 2022 21:15:56 -0800 Subject: [PATCH] Use the new current_priority std function (in the os module) --- ctru-rs/examples/thread-basic.rs | 2 +- ctru-rs/src/thread.rs | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/ctru-rs/examples/thread-basic.rs b/ctru-rs/examples/thread-basic.rs index 24e8edd..93e684b 100644 --- a/ctru-rs/examples/thread-basic.rs +++ b/ctru-rs/examples/thread-basic.rs @@ -15,7 +15,7 @@ fn main() { let gfx = Gfx::default(); let _console = Console::init(gfx.top_screen.borrow_mut()); - let prio = ctru::thread::priority(); + let prio = std::os::horizon::thread::current_priority(); println!("Main thread prio: {}\n", prio); for ix in 0..3 { diff --git a/ctru-rs/src/thread.rs b/ctru-rs/src/thread.rs index 9eef8f1..24e33ea 100644 --- a/ctru-rs/src/thread.rs +++ b/ctru-rs/src/thread.rs @@ -24,18 +24,6 @@ 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 { - 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. pub fn affinity() -> i32 { unsafe { svcGetProcessorID() }