Browse Source

Remove unneeded init functions

pull/22/head
Andrea Ciliberti 2 years ago
parent
commit
d31966b65d
  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 @@ @@ -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,

15
src/lib.rs

@ -9,17 +9,6 @@ mod rwlock; @@ -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 <https://github.com/rust-lang/rust/issues/47384>
/// 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() {}

2
src/misc.rs

@ -1,7 +1,5 @@ @@ -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);

2
src/mutex.rs

@ -1,7 +1,5 @@ @@ -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,

2
src/rwlock.rs

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

2
src/thread.rs

@ -8,8 +8,6 @@ use std::sync::atomic::{AtomicUsize, Ordering}; @@ -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;

2
src/thread/attr.rs

@ -1,8 +1,6 @@ @@ -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.

2
src/thread_keys.rs

@ -4,8 +4,6 @@ use spin::rwlock::RwLock; @@ -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);

Loading…
Cancel
Save