Browse Source

Use the new current_processor std function (in the os module)

This lets us delete the ctru-rs thread module.
pull/46/head
AzureMarker 3 years ago
parent
commit
2d49cd91ec
No known key found for this signature in database
GPG Key ID: 47A133F3BF9D03D3
  1. 1
      ctru-rs/src/lib.rs
  2. 30
      ctru-rs/src/thread.rs

1
ctru-rs/src/lib.rs

@ -43,7 +43,6 @@ pub mod error;
pub mod gfx; pub mod gfx;
pub mod services; pub mod services;
pub mod srv; pub mod srv;
pub mod thread;
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(all(feature = "romfs", romfs_exists))] { if #[cfg(all(feature = "romfs", romfs_exists))] {

30
ctru-rs/src/thread.rs

@ -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() }
}
Loading…
Cancel
Save