From a2f5e212448f36f0b35cf695d13bb4defdb4472e Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 13 Jul 2009 15:00:46 -0700 Subject: added pthread_cond_timedwait_relative_np() --- libc/bionic/pthread.c | 15 +++++++++++++++ libc/include/pthread.h | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'libc') diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index ec3c459..5712840 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -1204,6 +1204,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, } +/* this one exists only for backward binary compatibility */ int pthread_cond_timedwait_monotonic(pthread_cond_t *cond, pthread_mutex_t * mutex, const struct timespec *abstime) @@ -1211,6 +1212,20 @@ int pthread_cond_timedwait_monotonic(pthread_cond_t *cond, return __pthread_cond_timedwait(cond, mutex, abstime, CLOCK_MONOTONIC); } +int pthread_cond_timedwait_monotonic_np(pthread_cond_t *cond, + pthread_mutex_t * mutex, + const struct timespec *abstime) +{ + return __pthread_cond_timedwait(cond, mutex, abstime, CLOCK_MONOTONIC); +} + +int pthread_cond_timedwait_relative_np(pthread_cond_t *cond, + pthread_mutex_t * mutex, + const struct timespec *reltime) +{ + return __pthread_cond_timedwait_relative(cond, mutex, reltime); +} + int pthread_cond_timeout_np(pthread_cond_t *cond, pthread_mutex_t * mutex, unsigned msecs) diff --git a/libc/include/pthread.h b/libc/include/pthread.h index e3afdae..ae7b758 100644 --- a/libc/include/pthread.h +++ b/libc/include/pthread.h @@ -179,10 +179,30 @@ int pthread_cond_timedwait(pthread_cond_t *cond, * to the CLOCK_MONOTONIC clock instead, to avoid any problems when * the wall-clock time is changed brutally */ +int pthread_cond_timedwait_monotonic_np(pthread_cond_t *cond, + pthread_mutex_t *mutex, + const struct timespec *abstime); + +/* BIONIC: DEPRECATED. same as pthread_cond_timedwait_monotonic_np() + * unfortunately pthread_cond_timedwait_monotonic has shipped already + */ int pthread_cond_timedwait_monotonic(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime); +#define HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC 1 + +/* BIONIC: same as pthread_cond_timedwait, except the 'reltime' given refers + * is relative to the current time. + */ +int pthread_cond_timedwait_relative_np(pthread_cond_t *cond, + pthread_mutex_t *mutex, + const struct timespec *reltime); + +#define HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE 1 + + + int pthread_cond_timeout_np(pthread_cond_t *cond, pthread_mutex_t * mutex, unsigned msecs); -- cgit v1.1