summaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread.c
diff options
context:
space:
mode:
authorMatthieu CASTET <matthieu.castet@gmail.com>2008-12-27 00:04:10 +0100
committerJean-Baptiste Queru <jbq@google.com>2009-09-14 09:19:42 -0700
commita4e67f4512e2609c13a67d569bff14001413a042 (patch)
tree6e25ea92c5d2d407068b088ca9e46e9ad2ffb9b5 /libc/bionic/pthread.c
parent76ec6891e2bc18c9e12cd2f567358bb817b24cff (diff)
downloadbionic-a4e67f4512e2609c13a67d569bff14001413a042.zip
bionic-a4e67f4512e2609c13a67d569bff14001413a042.tar.gz
bionic-a4e67f4512e2609c13a67d569bff14001413a042.tar.bz2
Remove code duplication for pthread_cond_timeout_np : use __pthread_cond_timedwait_relative helper
Diffstat (limited to 'libc/bionic/pthread.c')
-rw-r--r--libc/bionic/pthread.c12
1 files changed, 1 insertions, 11 deletions
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);
}