From 2d49cd91ec5f54b6e463ab5605759f4bfaeb7e05 Mon Sep 17 00:00:00 2001 From: AzureMarker Date: Sun, 13 Feb 2022 18:39:35 -0800 Subject: [PATCH] Use the new current_processor std function (in the os module) This lets us delete the ctru-rs thread module. --- ctru-rs/src/lib.rs | 1 - ctru-rs/src/thread.rs | 30 ------------------------------ 2 files changed, 31 deletions(-) delete mode 100644 ctru-rs/src/thread.rs diff --git a/ctru-rs/src/lib.rs b/ctru-rs/src/lib.rs index 6b90da3..ed77651 100644 --- a/ctru-rs/src/lib.rs +++ b/ctru-rs/src/lib.rs @@ -43,7 +43,6 @@ pub mod error; pub mod gfx; pub mod services; pub mod srv; -pub mod thread; cfg_if::cfg_if! { if #[cfg(all(feature = "romfs", romfs_exists))] { diff --git a/ctru-rs/src/thread.rs b/ctru-rs/src/thread.rs deleted file mode 100644 index 24e33ea..0000000 --- a/ctru-rs/src/thread.rs +++ /dev/null @@ -1,30 +0,0 @@ -//! 3DS-specific threading APIs -//! -//! The standard library's thread API has been minimally extended for the 3DS to -//! expose the ability to set a thread's priority level and to pin a thread to a -//! specific CPU core. This module exists to provide more libctru-specific -//! functionality not normally found in the standard library. -//! -//! All 3DS models have at least two CPU cores available to spawn threads on: -//! The application core (appcore) and the system core (syscore). The New 3DS -//! has an additional two cores, the first of which can also run user-created -//! threads. -//! -//! Threads spawned on the appcore are cooperative rather than preemptive. This -//! means that threads must explicitly yield control to other threads (whether -//! via synchronization primitives or explicit calls to `yield_now`) when they -//! are not actively performing work. Failure to do so may result in control -//! flow being stuck in an inactive thread while the other threads are powerless -//! to continue their work. -//! -//! However, it is possible to spawn one fully preemptive thread on the syscore -//! by using `apt::set_app_cpu_time_limit` to reserve a slice of time for a -//! thread to run. Attempting to run more than one thread at a time on the syscore -//! will result in an error. - -use ctru_sys::svcGetProcessorID; - -/// Returns the ID of the processor the current thread is running on. -pub fn affinity() -> i32 { - unsafe { svcGetProcessorID() } -}