Browse Source

Merge pull request #22 from rust3ds/refresh

Remove unneeded init functions
master
Meziu 2 years ago committed by GitHub
parent
commit
3c10dfb6f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/condvar.rs
  2. 15
      src/lib.rs
  3. 2
      src/misc.rs
  4. 2
      src/mutex.rs
  5. 2
      src/rwlock.rs
  6. 2
      src/thread.rs
  7. 2
      src/thread/attr.rs
  8. 2
      src/thread_keys.rs

2
src/condvar.rs

@ -1,7 +1,5 @@
//! PThread condition variables implemented using libctru. //! PThread condition variables implemented using libctru.
pub fn init() {}
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn pthread_cond_init( pub unsafe extern "C" fn pthread_cond_init(
cond: *mut libc::pthread_cond_t, cond: *mut libc::pthread_cond_t,

15
src/lib.rs

@ -8,18 +8,3 @@ mod mutex;
mod rwlock; mod rwlock;
mod thread; mod thread;
mod thread_keys; mod thread_keys;
/// Call this somewhere to force Rust to link this module.
/// The call doesn't need to execute, just exist.
///
/// See <https://github.com/rust-lang/rust/issues/47384>
#[inline(always)]
pub fn init() {
condvar::init();
misc::init();
mutex::init();
rwlock::init();
thread::init();
thread::attr::init();
thread_keys::init();
}

2
src/misc.rs

@ -1,7 +1,5 @@
//! Miscellaneous pthread functions //! Miscellaneous pthread functions
pub fn init() {}
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn sched_yield() -> libc::c_int { pub unsafe extern "C" fn sched_yield() -> libc::c_int {
ctru_sys::svcSleepThread(0); ctru_sys::svcSleepThread(0);

2
src/mutex.rs

@ -1,7 +1,5 @@
//! PThread mutex implemented using libctru. //! PThread mutex implemented using libctru.
pub fn init() {}
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn pthread_mutexattr_init( pub unsafe extern "C" fn pthread_mutexattr_init(
_attr: *mut libc::pthread_mutexattr_t, _attr: *mut libc::pthread_mutexattr_t,

2
src/rwlock.rs

@ -1,7 +1,5 @@
//! PThread read-write lock implemented using libctru. //! PThread read-write lock implemented using libctru.
pub fn init() {}
use crate::{condvar, mutex}; use crate::{condvar, mutex};
struct rwlock_clear { struct rwlock_clear {

2
src/thread.rs

@ -8,8 +8,6 @@ use std::sync::atomic::{AtomicUsize, Ordering};
pub mod attr; pub mod attr;
pub fn init() {}
/// The main thread's pthread ID /// The main thread's pthread ID
const MAIN_THREAD_ID: libc::pthread_t = 0; const MAIN_THREAD_ID: libc::pthread_t = 0;

2
src/thread/attr.rs

@ -1,8 +1,6 @@
use static_assertions::const_assert; use static_assertions::const_assert;
use std::mem; use std::mem;
pub fn init() {}
/// Internal struct for storing pthread attribute data /// Internal struct for storing pthread attribute data
/// Must be less than or equal to the size of `libc::pthread_attr_t`. We assert /// Must be less than or equal to the size of `libc::pthread_attr_t`. We assert
/// this below via static_assertions. /// this below via static_assertions.

2
src/thread_keys.rs

@ -4,8 +4,6 @@ use spin::rwlock::RwLock;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
pub fn init() {}
type Key = usize; type Key = usize;
type Destructor = unsafe extern "C" fn(*mut libc::c_void); type Destructor = unsafe extern "C" fn(*mut libc::c_void);

Loading…
Cancel
Save