Browse Source

Merge pull request #11 from Meziu/tweak/processor-naming

Rename "ideal_processor" to "processor_id"
pull/12/head
Meziu 3 years ago committed by GitHub
parent
commit
187d2ae5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      src/lib.rs

20
src/lib.rs

@ -26,7 +26,7 @@ pub unsafe extern "C" fn pthread_create(
let attr = attr as *const PThreadAttr; let attr = attr as *const PThreadAttr;
let stack_size = (*attr).stack_size as ctru_sys::size_t; let stack_size = (*attr).stack_size as ctru_sys::size_t;
let priority = (*attr).priority; let priority = (*attr).priority;
let ideal_processor = (*attr).ideal_processor; let processor_id = (*attr).processor_id;
extern "C" fn thread_start(main: *mut libc::c_void) { extern "C" fn thread_start(main: *mut libc::c_void) {
unsafe { unsafe {
@ -47,7 +47,7 @@ pub unsafe extern "C" fn pthread_create(
main as *mut libc::c_void, main as *mut libc::c_void,
stack_size, stack_size,
priority, priority,
ideal_processor, processor_id,
false, false,
); );
@ -219,7 +219,7 @@ pub unsafe extern "C" fn pthread_getprocessorid_np() -> libc::c_int {
struct PThreadAttr { struct PThreadAttr {
stack_size: libc::size_t, stack_size: libc::size_t,
priority: libc::c_int, priority: libc::c_int,
ideal_processor: libc::c_int, processor_id: libc::c_int,
} }
impl Default for PThreadAttr { impl Default for PThreadAttr {
@ -241,7 +241,7 @@ impl Default for PThreadAttr {
// If no processor is specified, spawn on the default core. // If no processor is specified, spawn on the default core.
// (determined by the application's Exheader) // (determined by the application's Exheader)
ideal_processor: -2, processor_id: -2,
} }
} }
} }
@ -299,23 +299,23 @@ pub unsafe extern "C" fn pthread_attr_setschedparam(
} }
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn pthread_attr_getidealprocessor_np( pub unsafe extern "C" fn pthread_attr_getprocessorid_np(
attr: *const libc::pthread_attr_t, attr: *const libc::pthread_attr_t,
ideal_processor: *mut libc::c_int, processor_id: *mut libc::c_int,
) -> libc::c_int { ) -> libc::c_int {
let attr = attr as *mut PThreadAttr; let attr = attr as *mut PThreadAttr;
(*ideal_processor) = (*attr).ideal_processor; (*processor_id) = (*attr).processor_id;
0 0
} }
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn pthread_attr_setidealprocessor_np( pub unsafe extern "C" fn pthread_attr_setprocessorid_np(
attr: *mut libc::pthread_attr_t, attr: *mut libc::pthread_attr_t,
ideal_processor: libc::c_int, processor_id: libc::c_int,
) -> libc::c_int { ) -> libc::c_int {
let attr = attr as *mut PThreadAttr; let attr = attr as *mut PThreadAttr;
(*attr).ideal_processor = ideal_processor; (*attr).processor_id = processor_id;
// TODO: we could validate the processor ID here if we wanted? // TODO: we could validate the processor ID here if we wanted?

Loading…
Cancel
Save