Skip to content

Commit

Permalink
Merge pull request #16 from ian-h-chamberlain/pthread_condattr
Browse files Browse the repository at this point in the history
Add pthread_condattr functions
  • Loading branch information
Meziu authored Apr 12, 2022
2 parents 1907d9a + c2458e4 commit d98570c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
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
}
}

0 comments on commit d98570c

Please sign in to comment.