@ -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,
@ -9,17 +9,6 @@ mod rwlock;
mod thread;
mod thread_keys;
/// Call this somewhere to force Rust to link this module.
/// Reference this function somewhere (eg. ´use pthread_3ds::init´ in the main crate) to import all pthread implementations.
/// 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();
}
//! Miscellaneous pthread functions
pub unsafe extern "C" fn sched_yield() -> libc::c_int {
ctru_sys::svcSleepThread(0);
//! PThread mutex implemented using libctru.
pub unsafe extern "C" fn pthread_mutexattr_init(
_attr: *mut libc::pthread_mutexattr_t,
//! PThread read-write lock implemented using libctru.
use crate::{condvar, mutex};
struct rwlock_clear {
@ -8,8 +8,6 @@ use std::sync::atomic::{AtomicUsize, Ordering};
pub mod attr;
/// The main thread's pthread ID
const MAIN_THREAD_ID: libc::pthread_t = 0;
@ -1,8 +1,6 @@
use static_assertions::const_assert;
use std::mem;
/// 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.
@ -4,8 +4,6 @@ use spin::rwlock::RwLock;
use std::collections::BTreeMap;
use std::sync::atomic::{AtomicUsize, Ordering};
type Key = usize;
type Destructor = unsafe extern "C" fn(*mut libc::c_void);