]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Move some code from gnulib module 'lock' to gnulib module 'threadlib'.
authorBruno Haible <bruno@clisp.org>
Sun, 17 Aug 2008 14:36:30 +0000 (14:36 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:15:48 +0000 (12:15 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/Makefile.in
gettext-runtime/intl/lock.c
gettext-runtime/intl/threadlib.c [new file with mode: 0644]

index 588751458d49b6d5fc44d6d79bc87001783b298b..af4d209a6d36965f29a9d773e5120ed90be25b1c 100644 (file)
@@ -1,3 +1,11 @@
+2008-08-17  Bruno Haible  <bruno@clisp.org>
+
+       * threadlib.c: New file, extracted from lock.c.
+       * lock.c (dummy_thread_func, glthread_in_use): Remove functions.
+       * Makefile.in (SOURCES): Add threadlib.c.
+       (OBJECTS): Add threadlib.$lo.
+       (threadlib.lo): New rule.
+
 2008-08-14  Bruno Haible  <bruno@clisp.org>
 
        * lock.h (glthread_lock_lock, glthread_lock_unlock,
index cfed0859a446b9dcba7e5f18d8e5f6d8753ba4ec..3d107c36893dae12a1ef9e2a4f357f0188775bba 100644 (file)
@@ -127,6 +127,7 @@ SOURCES = \
   plural.y \
   plural-exp.c \
   localcharset.c \
+  threadlib.c \
   lock.c \
   relocatable.c \
   langprefs.c \
@@ -157,6 +158,7 @@ OBJECTS = \
   plural.$lo \
   plural-exp.$lo \
   localcharset.$lo \
+  threadlib.$lo \
   lock.$lo \
   relocatable.$lo \
   langprefs.$lo \
@@ -254,6 +256,8 @@ plural-exp.lo: $(srcdir)/plural-exp.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
 localcharset.lo: $(srcdir)/localcharset.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c
+threadlib.lo: $(srcdir)/threadlib.c
+       $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/threadlib.c
 lock.lo: $(srcdir)/lock.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/lock.c
 relocatable.lo: $(srcdir)/relocatable.c
index 982e12ea6b02acefb919912e62ec2b0c2454b590..31c05bc05c8230333ecc5ea119f1414459840de1 100644 (file)
 
 #if USE_POSIX_THREADS
 
-/* Use the POSIX threads library.  */
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The function to be executed by a dummy thread.  */
-static void *
-dummy_thread_func (void *arg)
-{
-  return arg;
-}
-
-int
-glthread_in_use (void)
-{
-  static int tested;
-  static int result; /* 1: linked with -lpthread, 0: only with libc */
-
-  if (!tested)
-    {
-      pthread_t thread;
-
-      if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
-       /* Thread creation failed.  */
-       result = 0;
-      else
-       {
-         /* Thread creation works.  */
-         void *retval;
-         if (pthread_join (thread, &retval) != 0)
-           abort ();
-         result = 1;
-       }
-      tested = 1;
-    }
-  return result;
-}
-
-# endif
-
 /* -------------------------- gl_lock_t datatype -------------------------- */
 
 /* ------------------------- gl_rwlock_t datatype ------------------------- */
diff --git a/gettext-runtime/intl/threadlib.c b/gettext-runtime/intl/threadlib.c
new file mode 100644 (file)
index 0000000..72e4bd4
--- /dev/null
@@ -0,0 +1,68 @@
+/* Multithreading primitives.
+   Copyright (C) 2005-2008 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
+   by the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
+
+#include <config.h>
+
+/* ========================================================================= */
+
+#if USE_POSIX_THREADS
+
+/* Use the POSIX threads library.  */
+
+# if PTHREAD_IN_USE_DETECTION_HARD
+
+/* The function to be executed by a dummy thread.  */
+static void *
+dummy_thread_func (void *arg)
+{
+  return arg;
+}
+
+int
+glthread_in_use (void)
+{
+  static int tested;
+  static int result; /* 1: linked with -lpthread, 0: only with libc */
+
+  if (!tested)
+    {
+      pthread_t thread;
+
+      if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0)
+       /* Thread creation failed.  */
+       result = 0;
+      else
+       {
+         /* Thread creation works.  */
+         void *retval;
+         if (pthread_join (thread, &retval) != 0)
+           abort ();
+         result = 1;
+       }
+      tested = 1;
+    }
+  return result;
+}
+
+# endif
+
+#endif
+
+/* ========================================================================= */