]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Update from gnulib.
authorBruno Haible <bruno@clisp.org>
Fri, 30 Nov 2007 16:08:32 +0000 (16:08 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:15:34 +0000 (12:15 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/lock.c
gettext-runtime/intl/lock.h

index 13740698f30f2baa13afac354734a4b4917b54c1..b436af6278270fb45162884d51ba84bfec77180e 100644 (file)
@@ -1,3 +1,12 @@
+2007-11-30  Bruno Haible  <bruno@clisp.org>
+
+       * lock.h (gl_recursive_lock_init) [PTHREAD &&
+       PTHREAD_RECURSIVE_MUTEX_INITIALIZER]: Call
+       glthread_recursive_lock_init.
+       * lock.c (glthread_recursive_lock_init)
+       [PTHREAD_RECURSIVE_MUTEX_INITIALIZER]: New function.
+       Reported by Yoann Vandoorselaere <yoann.v@prelude-ids.com>.
+
 2007-11-28  Bruno Haible  <bruno@clisp.org>
 
        * libgnuintl.h.in (fprintf, vfprintf, printf, vprintf, sprintf,
index f60a8d9be1dea2ab03b4450fbcc61a47dd3365ba..728bd7b5aa42bc87b142edbd181244c874a4d5ab 100644 (file)
@@ -1,5 +1,5 @@
 /* Locking in multithreaded situations.
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
@@ -251,7 +251,24 @@ glthread_rwlock_destroy (gl_rwlock_t *lock)
 
 # if HAVE_PTHREAD_MUTEX_RECURSIVE
 
-#  if !(defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#  if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+void
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+  pthread_mutexattr_t attributes;
+
+  if (pthread_mutexattr_init (&attributes) != 0)
+    abort ();
+  if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0)
+    abort ();
+  if (pthread_mutex_init (lock, &attributes) != 0)
+    abort ();
+  if (pthread_mutexattr_destroy (&attributes) != 0)
+    abort ();
+}
+
+#  else
 
 void
 glthread_recursive_lock_init (gl_recursive_lock_t *lock)
index 144531dc5c9d7535bd08cfd4b96f0042781e96e0..7642f0fdcb17511998dbe3bc0c7f5a073cdf1e65 100644 (file)
@@ -362,11 +362,11 @@ typedef pthread_mutex_t gl_recursive_lock_t;
        PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 #   endif
 #   define gl_recursive_lock_init(NAME) \
-      do                                                                  \
-        {                                                                 \
-          if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) \
-            abort ();                                                     \
-        }                                                                 \
+      do                                          \
+        {                                         \
+          if (pthread_in_use ())                  \
+            glthread_recursive_lock_init (&NAME); \
+        }                                         \
       while (0)
 #   define gl_recursive_lock_lock(NAME) \
       do                                                            \
@@ -389,6 +389,7 @@ typedef pthread_mutex_t gl_recursive_lock_t;
             abort ();                                                  \
         }                                                              \
       while (0)
+extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
 
 #  else