changeset 10422:f52b084922aa

Don't redefine ETIMEDOUT on Solaris.
author Bruno Haible <bruno@clisp.org>
date Sat, 13 Sep 2008 11:55:59 +0200
parents ab772691412e
children 51c125f4cd8d
files ChangeLog lib/glthread/cond.c lib/glthread/cond.h
diffstat 3 files changed, 32 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/lib/glthread/cond.c
+++ b/lib/glthread/cond.c
@@ -50,3 +50,24 @@
 #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
+
+/* ========================================================================= */
--- a/lib/glthread/cond.h
+++ b/lib/glthread/cond.h
@@ -239,8 +239,6 @@
 
 /* -------------------------- 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 @@
 # 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
 }