From 9036fbd9f324256fee4b0f2259bdc8bb5a5eac04 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 13 Sep 2008 11:55:59 +0200 Subject: [PATCH] Don't redefine ETIMEDOUT on Solaris. --- ChangeLog | 9 +++++++++ lib/glthread/cond.c | 21 +++++++++++++++++++++ lib/glthread/cond.h | 5 ++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d416fa99..74acd3532 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-09-13 Bruno Haible + + * lib/glthread/cond.h [USE_SOLARIS_THREADS] + (ETIMEDOUT): Remove macro. + (glthread_cond_timedwait_multithreaded): New declaration. + (glthread_cond_timedwait): Use it. + * lib/glthread/cond.c [USE_SOLARIS_THREADS] + (glthread_cond_timedwait_multithreaded): New function. + 2008-09-12 Paolo Bonzini * modules/poll-tests: Do not check for io.h. diff --git a/lib/glthread/cond.c b/lib/glthread/cond.c index b2ac071df..e3073d586 100644 --- a/lib/glthread/cond.c +++ b/lib/glthread/cond.c @@ -50,3 +50,24 @@ glthread_cond_timedwait_multithreaded (gl_cond_t *cond, #endif /* ========================================================================= */ + +#if USE_SOLARIS_THREADS + +/* -------------------------- gl_cond_t datatype -------------------------- */ + +int +glthread_cond_timedwait_multithreaded (gl_cond_t *cond, + gl_lock_t *lock, + struct timespec *abstime) +{ + int ret; + + ret = cond_timedwait (cond, lock, abstime); + if (ret == ETIME) + return ETIMEDOUT; + return ret; +} + +#endif + +/* ========================================================================= */ diff --git a/lib/glthread/cond.h b/lib/glthread/cond.h index f832637c1..5939004cc 100644 --- a/lib/glthread/cond.h +++ b/lib/glthread/cond.h @@ -239,8 +239,6 @@ extern "C" { /* -------------------------- gl_cond_t datatype -------------------------- */ -#define ETIMEDOUT ETIME - typedef pthread_cond_t gl_cond_t; # define gl_cond_define(STORAGECLASS, NAME) \ STORAGECLASS cond_t NAME; @@ -253,13 +251,14 @@ typedef pthread_cond_t gl_cond_t; # define glthread_cond_wait(COND, LOCK) \ (pthread_in_use () ? cond_wait (COND, LOCK) : 0) # define glthread_cond_timedwait(COND, LOCK, ABSTIME) \ - (pthread_in_use () ? cond_timedwait (COND, LOCK, ABSTIME) : 0) + (pthread_in_use () ? glthread_cond_timedwait_multithreaded (COND, LOCK, ABSTIME) : 0) # define glthread_cond_signal(COND) \ (pthread_in_use () ? cond_signal (COND) : 0) # define glthread_cond_broadcast(COND) \ (pthread_in_use () ? cond_broadcast (COND) : 0) # define glthread_cond_destroy(COND) \ (pthread_in_use () ? cond_destroy (COND) : 0) +extern int glthread_cond_timedwait_multithreaded (gl_cond_t *cond, gl_lock_t *lock, struct timespec *abstime); # ifdef __cplusplus } -- 2.11.0