From d31966b65d6390587ede70b5dcb46db76d51fe9a Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Tue, 14 Feb 2023 17:42:49 +0100 Subject: [PATCH 1/2] Remove unneeded init functions --- src/condvar.rs | 2 -- src/lib.rs | 15 ++------------- src/misc.rs | 2 -- src/mutex.rs | 2 -- src/rwlock.rs | 2 -- src/thread.rs | 2 -- src/thread/attr.rs | 2 -- src/thread_keys.rs | 2 -- 8 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/condvar.rs b/src/condvar.rs index acf8b02..4d94a31 100644 --- a/src/condvar.rs +++ b/src/condvar.rs @@ -1,7 +1,5 @@ //! PThread condition variables implemented using libctru. -pub fn init() {} - #[no_mangle] pub unsafe extern "C" fn pthread_cond_init( cond: *mut libc::pthread_cond_t, diff --git a/src/lib.rs b/src/lib.rs index dc719d7..e59b86f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,17 +9,6 @@ mod rwlock; mod thread; mod thread_keys; -/// Call this somewhere to force Rust to link this module. -/// The call doesn't need to execute, just exist. -/// -/// See +/// Reference this function somewhere (eg. ´use pthread_3ds::init´ in the main crate) to import all pthread implementations. #[inline(always)] -pub fn init() { - condvar::init(); - misc::init(); - mutex::init(); - rwlock::init(); - thread::init(); - thread::attr::init(); - thread_keys::init(); -} +pub fn init() {} diff --git a/src/misc.rs b/src/misc.rs index 100daae..1ff9ba0 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -1,7 +1,5 @@ //! Miscellaneous pthread functions -pub fn init() {} - #[no_mangle] pub unsafe extern "C" fn sched_yield() -> libc::c_int { ctru_sys::svcSleepThread(0); diff --git a/src/mutex.rs b/src/mutex.rs index 2d8dc41..568cb6e 100644 --- a/src/mutex.rs +++ b/src/mutex.rs @@ -1,7 +1,5 @@ //! PThread mutex implemented using libctru. -pub fn init() {} - #[no_mangle] pub unsafe extern "C" fn pthread_mutexattr_init( _attr: *mut libc::pthread_mutexattr_t, diff --git a/src/rwlock.rs b/src/rwlock.rs index e3fc48a..365e960 100644 --- a/src/rwlock.rs +++ b/src/rwlock.rs @@ -1,7 +1,5 @@ //! PThread read-write lock implemented using libctru. -pub fn init() {} - use crate::{condvar, mutex}; struct rwlock_clear { diff --git a/src/thread.rs b/src/thread.rs index a00b301..01f2550 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -8,8 +8,6 @@ use std::sync::atomic::{AtomicUsize, Ordering}; pub mod attr; -pub fn init() {} - /// The main thread's pthread ID const MAIN_THREAD_ID: libc::pthread_t = 0; diff --git a/src/thread/attr.rs b/src/thread/attr.rs index 039283c..b445ddb 100644 --- a/src/thread/attr.rs +++ b/src/thread/attr.rs @@ -1,8 +1,6 @@ use static_assertions::const_assert; use std::mem; -pub fn init() {} - /// Internal struct for storing pthread attribute data /// Must be less than or equal to the size of `libc::pthread_attr_t`. We assert /// this below via static_assertions. diff --git a/src/thread_keys.rs b/src/thread_keys.rs index 1deb9d1..5486d4e 100644 --- a/src/thread_keys.rs +++ b/src/thread_keys.rs @@ -4,8 +4,6 @@ use spin::rwlock::RwLock; use std::collections::BTreeMap; use std::sync::atomic::{AtomicUsize, Ordering}; -pub fn init() {} - type Key = usize; type Destructor = unsafe extern "C" fn(*mut libc::c_void); From ead0dfe5b8adac05bd565a9336e261bb41e839bc Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Wed, 15 Feb 2023 13:58:51 +0100 Subject: [PATCH 2/2] init function removal --- src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e59b86f..28046e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,3 @@ mod mutex; mod rwlock; mod thread; mod thread_keys; - -/// Reference this function somewhere (eg. ´use pthread_3ds::init´ in the main crate) to import all pthread implementations. -#[inline(always)] -pub fn init() {}