From a4e67f4512e2609c13a67d569bff14001413a042 Mon Sep 17 00:00:00 2001 From: Matthieu CASTET Date: Sat, 27 Dec 2008 00:04:10 +0100 Subject: Remove code duplication for pthread_cond_timeout_np : use __pthread_cond_timedwait_relative helper --- libc/bionic/pthread.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'libc/bionic/pthread.c') diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index ec3c459..d2c81a3 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -1215,22 +1215,12 @@ int pthread_cond_timeout_np(pthread_cond_t *cond, pthread_mutex_t * mutex, unsigned msecs) { - int oldvalue; struct timespec ts; - int status; ts.tv_sec = msecs / 1000; ts.tv_nsec = (msecs % 1000) * 1000000; - oldvalue = cond->value; - - pthread_mutex_unlock(mutex); - status = __futex_wait(&cond->value, oldvalue, &ts); - pthread_mutex_lock(mutex); - - if(status == (-ETIMEDOUT)) return ETIMEDOUT; - - return 0; + return __pthread_cond_timedwait_relative(cond, mutex, &ts); } -- cgit v1.1