Don't redefine ETIMEDOUT on Solaris.
authorBruno Haible <bruno@clisp.org>
Sat, 13 Sep 2008 09:55:59 +0000 (11:55 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 13 Sep 2008 09:55:59 +0000 (11:55 +0200)
ChangeLog
lib/glthread/cond.c
lib/glthread/cond.h

index 8d416fa..74acd35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-13  Bruno Haible  <bruno@clisp.org>
+
+       * 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  <bonzini@gnu.org>
 
        * modules/poll-tests: Do not check for io.h.
index b2ac071..e3073d5 100644 (file)
@@ -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
+
+/* ========================================================================= */
index f832637..5939004 100644 (file)
@@ -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
 }