Browse Source

Merge pull request #16 from ian-h-chamberlain/pthread_condattr

Add pthread_condattr functions
pull/17/head
Meziu 3 years ago committed by GitHub
parent
commit
d98570c6ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      src/condvar.rs

35
src/condvar.rs

@ -82,3 +82,38 @@ pub unsafe extern "C" fn pthread_cond_timedwait(
pub unsafe extern "C" fn pthread_cond_destroy(_cond: *mut libc::pthread_cond_t) -> libc::c_int { pub unsafe extern "C" fn pthread_cond_destroy(_cond: *mut libc::pthread_cond_t) -> libc::c_int {
0 0
} }
#[no_mangle]
pub extern "C" fn pthread_condattr_init(_attr: *const libc::pthread_condattr_t) -> libc::c_int {
0
}
#[no_mangle]
pub extern "C" fn pthread_condattr_destroy(_attr: *const libc::pthread_condattr_t) -> libc::c_int {
0
}
#[no_mangle]
pub extern "C" fn pthread_condattr_getclock(
_attr: *const libc::pthread_condattr_t,
clock_id: *mut libc::clockid_t,
) -> libc::c_int {
unsafe {
*clock_id = libc::CLOCK_REALTIME;
}
0
}
#[no_mangle]
pub extern "C" fn pthread_condattr_setclock(
_attr: *mut libc::pthread_condattr_t,
clock_id: libc::clockid_t,
) -> libc::c_int {
// only one clock is supported, so all other options are considered an error
if clock_id == libc::CLOCK_REALTIME {
0
} else {
libc::EINVAL
}
}

Loading…
Cancel
Save