From fbb0d77f5dbdf9d013e54f6ec5f8bdf10c3fa0a1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 17 Aug 2008 21:26:13 +0200 Subject: [PATCH] Fix syntax errors in C++ mode. --- lib/glthread/cond.h | 20 ++++++++++++++++++++ lib/glthread/thread.h | 23 +++++++++++++++++++++-- lib/glthread/yield.h | 16 ++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/lib/glthread/cond.h b/lib/glthread/cond.h index 2fb7df5dc0..f71e62716a 100644 --- a/lib/glthread/cond.h +++ b/lib/glthread/cond.h @@ -140,6 +140,10 @@ typedef pthread_cond_t gl_cond_t; # define glthread_cond_destroy(COND) \ (pthread_in_use () ? pthread_cond_destroy (COND) : 0) +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -195,6 +199,10 @@ typedef pth_cond_t gl_cond_t; # define glthread_cond_destroy(COND) 0 extern int glthread_cond_timedwait_multithreaded (gl_cond_t *cond, gl_lock_t *lock, struct timespec *abstime); +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -253,6 +261,10 @@ typedef pthread_cond_t gl_cond_t; # define glthread_cond_destroy(COND) \ (pthread_in_use () ? cond_destroy (COND) : 0) +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -277,6 +289,10 @@ typedef int gl_cond_t; /* Macros with built-in error handling. */ +#ifdef __cplusplus +extern "C" { +#endif + #define gl_cond_init(COND) \ do \ { \ @@ -325,4 +341,8 @@ gl_cond_timedwait_func (gl_cond_t *cond, gl_lock_t *lock, struct timespec *absti } \ while (0) +#ifdef __cplusplus +} +#endif + #endif /* _GLTHREAD_COND_H */ diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index bd8575f11b..5c98cddd28 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -156,6 +156,10 @@ typedef pthread_t gl_thread_t; # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 # endif +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -203,6 +207,10 @@ typedef pth_t gl_thread_t; (pth_in_use () ? pth_exit (RETVAL) : 0) # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -250,8 +258,12 @@ typedef thread_t gl_thread_t; # define gl_thread_exit(RETVAL) \ (pthread_in_use () ? thr_exit (RETVAL) : 0) # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 -#endif +# ifdef __cplusplus +} +# endif + +#endif /* ========================================================================= */ @@ -269,11 +281,14 @@ typedef int gl_thread_t; #endif - /* ========================================================================= */ /* Macros with built-in error handling. */ +#ifdef __cplusplus +extern "C" { +#endif + static inline gl_thread_t gl_thread_create (void *(*func) (void *arg), void *arg) { @@ -307,4 +322,8 @@ gl_thread_create (void *(*func) (void *arg), void *arg) } \ while (0) +#ifdef __cplusplus +} +#endif + #endif /* _GLTHREAD_THREAD_H */ diff --git a/lib/glthread/yield.h b/lib/glthread/yield.h index 80cfb888aa..f2083135e9 100644 --- a/lib/glthread/yield.h +++ b/lib/glthread/yield.h @@ -39,6 +39,10 @@ extern "C" { # define gl_thread_yield() \ sched_yield () +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -56,6 +60,10 @@ extern "C" { # define gl_thread_yield() \ pth_yield (NULL) +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -74,6 +82,10 @@ extern "C" { # define gl_thread_yield() \ thr_yield () +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ @@ -87,6 +99,10 @@ extern "C" { # define gl_thread_yield() \ Sleep (0) +# ifdef __cplusplus +} +# endif + #endif /* ========================================================================= */ -- 2.30.2