summaryrefslogtreecommitdiffstats
path: root/gettext-runtime/intl/loadmsgcat.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2005-07-18 11:28:21 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:12:38 +0200
commitc53d435e9a616a28e3bb78dc371df940519c9b16 (patch)
treee1d9135dfefb486f0561c02eb6acf5cb10af2ca6 /gettext-runtime/intl/loadmsgcat.c
parent6c4eda658c18d792871d4a2f3d1a7ce94692be7b (diff)
downloadexternal_gettext-c53d435e9a616a28e3bb78dc371df940519c9b16.zip
external_gettext-c53d435e9a616a28e3bb78dc371df940519c9b16.tar.gz
external_gettext-c53d435e9a616a28e3bb78dc371df940519c9b16.tar.bz2
Use lock.h.
Diffstat (limited to 'gettext-runtime/intl/loadmsgcat.c')
-rw-r--r--gettext-runtime/intl/loadmsgcat.c56
1 files changed, 1 insertions, 55 deletions
diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c
index babed63..4b01dca 100644
--- a/gettext-runtime/intl/loadmsgcat.c
+++ b/gettext-runtime/intl/loadmsgcat.c
@@ -95,64 +95,10 @@ char *alloca ();
#endif
/* Handle multi-threaded applications. */
-#ifdef THREAD_H
-# include THREAD_H
-#endif
#ifdef _LIBC
# include <bits/libc-lock.h>
#else
-# if USE_POSIX_THREADS
-# define __libc_lock_define_recursive(CLASS, NAME) \
- CLASS pthread_mutex_t NAME;
-# define __libc_lock_define_initialized_recursive(CLASS, NAME) \
- CLASS pthread_mutex_t NAME; \
- static pthread_mutex_t NAME##_aux = PTHREAD_MUTEX_INITIALIZER; \
- static int NAME##_initialized = 0; \
- auto int NAME##_dummy = \
- ((NAME##_initialized == 0 \
- ? mutex_init_recursive (&NAME, &NAME##_aux), NAME##_initialized = 1, 0 \
- : 0), NAME##_dummy);
-static inline void
-mutex_init_recursive (pthread_mutex_t *mutex, pthread_mutex_t *mutex_aux)
-{
- pthread_mutexattr_t attributes;
-
- if (pthread_mutex_lock (mutex_aux) != 0)
- abort ();
- if (pthread_mutexattr_init (&attributes) != 0)
- abort ();
- if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0)
- abort ();
- if (pthread_mutex_init (mutex, &attributes) != 0)
- abort ();
- if (pthread_mutexattr_destroy (&attributes) != 0)
- abort ();
- if (pthread_mutex_unlock (mutex_aux) != 0)
- abort ();
-}
-# define __libc_lock_lock_recursive(NAME) \
- if (pthread_mutex_lock (&NAME) != 0) abort ()
-# define __libc_lock_unlock_recursive(NAME) \
- if (pthread_mutex_unlock (&NAME) != 0) abort ()
-# else
-# if USE_PTH_THREADS
- /* In Pth, mutexes are recursive by default. */
-# define __libc_lock_define_recursive(CLASS, NAME) \
- CLASS pth_mutex_t NAME;
-# define __libc_lock_define_initialized_recursive(CLASS, NAME) \
- CLASS pth_mutex_t NAME = PTH_MUTEX_INIT;
-# define __libc_lock_lock_recursive(NAME) \
- if (!pth_mutex_acquire (&NAME, 0, NULL)) abort ()
-# define __libc_lock_unlock_recursive(NAME) \
- if (!pth_mutex_release (&NAME)) abort ()
-# else
-/* Provide dummy implementation if threads are not supported. */
-# define __libc_lock_define_recursive(CLASS, NAME)
-# define __libc_lock_define_initialized_recursive(CLASS, NAME)
-# define __libc_lock_lock_recursive(NAME)
-# define __libc_lock_unlock_recursive(NAME)
-# endif
-# endif
+# include "lock.h"
#endif
/* Provide fallback values for macros that ought to be defined in <inttypes.h>.