]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Update gnulib files. Drop slow test-lock check.
authorSimon Josefsson <simon@josefsson.org>
Wed, 25 Jan 2012 09:59:09 +0000 (10:59 +0100)
committerSimon Josefsson <simon@josefsson.org>
Wed, 25 Jan 2012 09:59:09 +0000 (10:59 +0100)
29 files changed:
build-aux/config.rpath
build-aux/pmccabe.css
gl/Makefile.am
gl/argp-pin.c
gl/m4/gnulib-cache.m4
gl/m4/gnulib-comp.m4
gl/m4/thread.m4 [deleted file]
gl/m4/yield.m4 [deleted file]
gl/stdint.in.h
gl/tests/Makefile.am
gl/tests/glthread/thread.c [deleted file]
gl/tests/glthread/thread.h [deleted file]
gl/tests/glthread/yield.h [deleted file]
gl/tests/test-accept.c
gl/tests/test-bind.c
gl/tests/test-connect.c
gl/tests/test-getpeername.c
gl/tests/test-isnand-nolibm.c
gl/tests/test-listen.c
gl/tests/test-lock.c [deleted file]
gl/tests/test-recv.c
gl/tests/test-recvfrom.c
gl/tests/test-send.c
gl/tests/test-sendto.c
gl/tests/test-setsockopt.c
gl/tests/test-shutdown.c
gl/tests/test-thread_create.c [deleted file]
gl/tests/test-thread_self.c [deleted file]
maint.mk

index c0d31f92af6ecf34bf841ba47286d3bb2d9710fc..1a0701828172aad0b521ad96735149fdd0bf1875 100755 (executable)
@@ -25,7 +25,7 @@
 #   known workaround is to choose shorter directory names for the build
 #   directory and/or the installation directory.
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a '.a' archive for static linking (except MSVC,
 # which needs '.lib').
 libext=a
 shrext=.so
index b78bc10082ee4cea06e5ca77b9ffaaaf3d00248a..a10ee35026b04d92d18eeec1e242d77ec5695a3b 100644 (file)
@@ -56,7 +56,7 @@ body {
 }
 
 .ranges_entry_simple {
-    background: #87ff75; 
+    background: #87ff75;
 }
 
 .ranges_entry_moderate {
@@ -105,7 +105,7 @@ body {
 
 
 .function_entry_simple {
-    background: #87ff75; 
+    background: #87ff75;
 }
 
 .function_entry_moderate {
index 05319f7b24ce42c486d0d0afd44f1d193d5692ea..5607417f45daccb0cfa7b884b3309fe26789493c 100644 (file)
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettime havelib inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto setsockopt shutdown snprintf socket sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettime havelib inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto setsockopt shutdown snprintf socket sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
index e50dad81a142c6f003ce74c301fbbdb2ee488dd4..aab8160518b80e37c23ca7a9567a417f1567d4af 100644 (file)
@@ -24,4 +24,3 @@ char *program_invocation_short_name = 0;
 #ifndef HAVE_PROGRAM_INVOCATION_NAME
 char *program_invocation_name = 0;
 #endif
-
index 0bbd5a6ded2a9d5db7ce16fb37e33363552d6f97..90b612adb0f2fa5025507ad79bf1d517c3d3254c 100644 (file)
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettime havelib inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto setsockopt shutdown snprintf socket sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
+#   gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca alphasort argp bind byteswap c-ctype close connect error extensions func gendocs getaddrinfo getpass getsubopt gettext gettime havelib inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html progname read-file recv recvfrom scandir select send sendto setsockopt shutdown snprintf socket sockets socklen stdint strcase strverscmp sys_socket sys_stat time_r timespec u64 unistd valgrind-tests vasprintf version-etc version-etc-fsf vfprintf-posix vprintf-posix vsnprintf warnings
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gl/override])
@@ -95,7 +95,7 @@ gl_MODULES([
   vsnprintf
   warnings
 ])
-gl_AVOID([alignof-tests lseek-tests])
+gl_AVOID([alignof-tests lock-tests lseek-tests])
 gl_SOURCE_BASE([gl])
 gl_M4_BASE([gl/m4])
 gl_PO_BASE([])
index c08041bac540f599cf1f517cfa0b1615c1f33c2e..a0edea22f48e5d994c43a657ad3e768cfd9feba4 100644 (file)
@@ -165,7 +165,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module listen:
   # Code from module listen-tests:
   # Code from module lock:
-  # Code from module lock-tests:
   # Code from module lseek:
   # Code from module lstat:
   # Code from module lstat-tests:
@@ -310,8 +309,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module sysexits-tests:
   # Code from module test-framework-sh:
   # Code from module test-framework-sh-tests:
-  # Code from module thread:
-  # Code from module thread-tests:
   # Code from module threadlib:
   gl_THREADLIB_EARLY
   # Code from module time:
@@ -347,7 +344,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module wchar:
   # Code from module wchar-tests:
   # Code from module xsize:
-  # Code from module yield:
 ])
 
 # This macro should be invoked from ./configure.ac, in the section
@@ -996,7 +992,6 @@ gl_UNISTD_MODULE_INDICATOR([symlink])
 gl_SYS_IOCTL_H
 AC_PROG_MKDIR_P
 AC_CHECK_FUNCS_ONCE([shutdown])
-gl_THREAD
 gl_THREADLIB
 gl_FUNC_UNSETENV
 if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
@@ -1007,7 +1002,6 @@ gl_STDLIB_MODULE_INDICATOR([unsetenv])
 gl_VALGRIND_TESTS
 abs_aux_dir=`cd "$ac_aux_dir"; pwd`
 AC_SUBST([abs_aux_dir])
-gl_YIELD
   m4_popdef([gl_MODULE_INDICATOR_CONDITION])
   m4_ifval(gltests_LIBSOURCES_LIST, [
     m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
@@ -1442,7 +1436,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/sys_types_h.m4
   m4/sys_uio_h.m4
   m4/sysexits.m4
-  m4/thread.m4
   m4/threadlib.m4
   m4/time_h.m4
   m4/time_r.m4
@@ -1464,7 +1457,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/wchar_t.m4
   m4/wint_t.m4
   m4/xsize.m4
-  m4/yield.m4
   tests/infinity.h
   tests/init.sh
   tests/macros.h
@@ -1545,7 +1537,6 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-isnanl-nolibm.c
   tests/test-isnanl.h
   tests/test-listen.c
-  tests/test-lock.c
   tests/test-lstat.c
   tests/test-lstat.h
   tests/test-malloc-gnu.c
@@ -1611,8 +1602,6 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-sys_uio.c
   tests/test-sys_wait.h
   tests/test-sysexits.c
-  tests/test-thread_create.c
-  tests/test-thread_self.c
   tests/test-time.c
   tests/test-u64.c
   tests/test-unistd.c
@@ -1641,10 +1630,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests=lib/getpagesize.c
   tests=lib/glthread/lock.c
   tests=lib/glthread/lock.h
-  tests=lib/glthread/thread.c
-  tests=lib/glthread/thread.h
   tests=lib/glthread/threadlib.c
-  tests=lib/glthread/yield.h
   tests=lib/ignore-value.h
   tests=lib/inttypes.in.h
   tests=lib/ioctl.c
diff --git a/gl/m4/thread.m4 b/gl/m4/thread.m4
deleted file mode 100644 (file)
index cd66c3e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# thread.m4 serial 2
-dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_THREAD],
-[
-  AC_REQUIRE([gl_THREADLIB])
-  AC_REQUIRE([AC_C_INLINE])
-
-  if test $gl_threads_api = posix; then
-    gl_save_LIBS="$LIBS"
-    LIBS="$LIBS $LIBMULTITHREAD"
-    AC_CHECK_FUNCS([pthread_atfork])
-    LIBS="$gl_save_LIBS"
-  fi
-])
diff --git a/gl/m4/yield.m4 b/gl/m4/yield.m4
deleted file mode 100644 (file)
index 94e69c4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# yield.m4 serial 2
-dnl Copyright (C) 2005-2012 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_YIELD],
-[
-  AC_REQUIRE([gl_THREADLIB])
-  dnl On some systems, sched_yield is in librt, rather than in libpthread.
-  YIELD_LIB=
-  if test $gl_threads_api = posix; then
-    dnl Solaris has sched_yield in librt, not in libpthread or libc.
-    AC_CHECK_LIB([rt], [sched_yield], [YIELD_LIB=-lrt],
-      [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt.
-       AC_CHECK_LIB([posix4], [sched_yield], [YIELD_LIB=-lposix4])])
-  fi
-  AC_SUBST([YIELD_LIB])
-])
index 6129f1a812972ea2bc7b0240a1fab383f142ae34..67df6d9d79db4a2ff15a69ef82ae2ad4a082ce50 100644 (file)
    <inttypes.h>.  */
 #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 
+/* On Android (Bionic libc), <sys/types.h> includes this file before
+   having defined 'time_t'.  Therefore in this case avoid including
+   other system header files; just include the system's <stdint.h>.
+   Ideally we should test __BIONIC__ here, but it is only defined after
+   <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
+#if defined __ANDROID__ \
+    && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
+#else
+
 /* Get those types that are already defined in other system include
    files, so that we can "#define int8_t signed char" below without
    worrying about a later system include file containing a "typedef
@@ -606,4 +616,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 #endif
 
 #endif /* _@GUARD_PREFIX@_STDINT_H */
+#endif /* !(defined __ANDROID__ && ...) */
 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
index 772c9f9d4db4ff6e6b9874e78661d5250dec6af5..fa7f5b4f0bf130721d3623d6d8130446a5c6362b 100644 (file)
@@ -621,15 +621,6 @@ libtests_a_SOURCES += glthread/lock.h glthread/lock.c
 
 ## end   gnulib module lock
 
-## begin gnulib module lock-tests
-
-TESTS += test-lock
-check_PROGRAMS += test-lock
-test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@
-EXTRA_DIST += test-lock.c
-
-## end   gnulib module lock-tests
-
 ## begin gnulib module lstat
 
 
@@ -1277,22 +1268,6 @@ EXTRA_DIST += test-init.sh
 
 ## end   gnulib module test-framework-sh-tests
 
-## begin gnulib module thread
-
-libtests_a_SOURCES += glthread/thread.h glthread/thread.c
-
-## end   gnulib module thread
-
-## begin gnulib module thread-tests
-
-TESTS += test-thread_self test-thread_create
-check_PROGRAMS += test-thread_self test-thread_create
-test_thread_self_LDADD = $(LDADD) @LIBTHREAD@
-test_thread_create_LDADD = $(LDADD) @LIBMULTITHREAD@
-EXTRA_DIST += test-thread_self.c test-thread_create.c macros.h
-
-## end   gnulib module thread-tests
-
 ## begin gnulib module threadlib
 
 libtests_a_SOURCES += glthread/threadlib.c
@@ -1420,12 +1395,6 @@ EXTRA_DIST += test-wchar.c
 
 ## end   gnulib module wchar-tests
 
-## begin gnulib module yield
-
-libtests_a_SOURCES += glthread/yield.h
-
-## end   gnulib module yield
-
 # Clean up after Solaris cc.
 clean-local:
        rm -rf SunWS_cache
diff --git a/gl/tests/glthread/thread.c b/gl/tests/glthread/thread.c
deleted file mode 100644 (file)
index be0a871..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/* Creating and controlling threads.
-   Copyright (C) 2005-2012 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, 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 General Public License for more details.
-
-   You should have received a copy of the GNU 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.
-   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
-   gthr-win32.h.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "glthread/thread.h"
-
-#include <stdlib.h>
-#include "glthread/lock.h"
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-#include <pthread.h>
-
-#ifdef PTW32_VERSION
-
-const gl_thread_t gl_null_thread /* = { .p = NULL } */;
-
-#endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WINDOWS_THREADS
-
-#include <process.h>
-
-/* -------------------------- gl_thread_t datatype -------------------------- */
-
-/* The Thread-Local Storage (TLS) key that allows to access each thread's
-   'struct gl_thread_struct *' pointer.  */
-static DWORD self_key = (DWORD)-1;
-
-/* Initializes self_key.  This function must only be called once.  */
-static void
-do_init_self_key (void)
-{
-  self_key = TlsAlloc ();
-  /* If this fails, we're hosed.  */
-  if (self_key == (DWORD)-1)
-    abort ();
-}
-
-/* Initializes self_key.  */
-static void
-init_self_key (void)
-{
-  gl_once_define(static, once)
-  gl_once (once, do_init_self_key);
-}
-
-/* This structure contains information about a thread.
-   It is stored in TLS under key self_key.  */
-struct gl_thread_struct
-{
-  /* Fields for managing the handle.  */
-  HANDLE volatile handle;
-  CRITICAL_SECTION handle_lock;
-  /* Fields for managing the exit value.  */
-  void * volatile result;
-  /* Fields for managing the thread start.  */
-  void * (*func) (void *);
-  void *arg;
-};
-
-/* Return a real HANDLE object for the current thread.  */
-static inline HANDLE
-get_current_thread_handle (void)
-{
-  HANDLE this_handle;
-
-  /* GetCurrentThread() returns a pseudo-handle, i.e. only a symbolic
-     identifier, not a real handle.  */
-  if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
-                        GetCurrentProcess (), &this_handle,
-                        0, FALSE, DUPLICATE_SAME_ACCESS))
-    abort ();
-  return this_handle;
-}
-
-gl_thread_t
-gl_thread_self_func (void)
-{
-  gl_thread_t thread;
-
-  if (self_key == (DWORD)-1)
-    init_self_key ();
-  thread = TlsGetValue (self_key);
-  if (thread == NULL)
-    {
-      /* This happens only in threads that have not been created through
-         glthread_create(), such as the main thread.  */
-      for (;;)
-        {
-          thread =
-            (struct gl_thread_struct *)
-            malloc (sizeof (struct gl_thread_struct));
-          if (thread != NULL)
-            break;
-          /* Memory allocation failed.  There is not much we can do.  Have to
-             busy-loop, waiting for the availability of memory.  */
-          Sleep (1);
-        }
-
-      thread->handle = get_current_thread_handle ();
-      InitializeCriticalSection (&thread->handle_lock);
-      thread->result = NULL; /* just to be deterministic */
-      TlsSetValue (self_key, thread);
-    }
-  return thread;
-}
-
-/* The main function of a freshly creating thread.  It's a wrapper around
-   the FUNC and ARG arguments passed to glthread_create_func.  */
-static unsigned int WINAPI
-wrapper_func (void *varg)
-{
-  struct gl_thread_struct *thread = (struct gl_thread_struct *)varg;
-
-  EnterCriticalSection (&thread->handle_lock);
-  /* Create a new handle for the thread only if the parent thread did not yet
-     fill in the handle.  */
-  if (thread->handle == NULL)
-    thread->handle = get_current_thread_handle ();
-  LeaveCriticalSection (&thread->handle_lock);
-
-  if (self_key == (DWORD)-1)
-    init_self_key ();
-  TlsSetValue (self_key, thread);
-
-  /* Run the thread.  Store the exit value if the thread was not terminated
-     otherwise.  */
-  thread->result = thread->func (thread->arg);
-  return 0;
-}
-
-int
-glthread_create_func (gl_thread_t *threadp, void * (*func) (void *), void *arg)
-{
-  struct gl_thread_struct *thread =
-    (struct gl_thread_struct *) malloc (sizeof (struct gl_thread_struct));
-  if (thread == NULL)
-    return ENOMEM;
-  thread->handle = NULL;
-  InitializeCriticalSection (&thread->handle_lock);
-  thread->result = NULL; /* just to be deterministic */
-  thread->func = func;
-  thread->arg = arg;
-
-  {
-    unsigned int thread_id;
-    HANDLE thread_handle;
-
-    thread_handle = (HANDLE)
-      _beginthreadex (NULL, 100000, wrapper_func, thread, 0, &thread_id);
-      /* calls CreateThread with the same arguments */
-    if (thread_handle == NULL)
-      {
-        DeleteCriticalSection (&thread->handle_lock);
-        free (thread);
-        return EAGAIN;
-      }
-
-    EnterCriticalSection (&thread->handle_lock);
-    if (thread->handle == NULL)
-      thread->handle = thread_handle;
-    else
-      /* thread->handle was already set by the thread itself.  */
-      CloseHandle (thread_handle);
-    LeaveCriticalSection (&thread->handle_lock);
-
-    *threadp = thread;
-    return 0;
-  }
-}
-
-int
-glthread_join_func (gl_thread_t thread, void **retvalp)
-{
-  if (thread == NULL)
-    return EINVAL;
-
-  if (thread == gl_thread_self ())
-    return EDEADLK;
-
-  if (WaitForSingleObject (thread->handle, INFINITE) == WAIT_FAILED)
-    return EINVAL;
-
-  if (retvalp != NULL)
-    *retvalp = thread->result;
-
-  DeleteCriticalSection (&thread->handle_lock);
-  CloseHandle (thread->handle);
-  free (thread);
-
-  return 0;
-}
-
-int
-gl_thread_exit_func (void *retval)
-{
-  gl_thread_t thread = gl_thread_self ();
-  thread->result = retval;
-  _endthreadex (0); /* calls ExitThread (0) */
-  abort ();
-}
-
-#endif
-
-/* ========================================================================= */
diff --git a/gl/tests/glthread/thread.h b/gl/tests/glthread/thread.h
deleted file mode 100644 (file)
index b95d6a2..0000000
+++ /dev/null
@@ -1,401 +0,0 @@
-/* Creating and controlling threads.
-   Copyright (C) 2005-2012 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, 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 General Public License for more details.
-
-   You should have received a copy of the GNU 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.
-   Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
-   gthr-win32.h.  */
-
-/* This file contains primitives for creating and controlling threads.
-
-   Thread data type: gl_thread_t.
-
-   Creating a thread:
-       thread = gl_thread_create (func, arg);
-   Or with control of error handling:
-       err = glthread_create (&thread, func, arg);
-       extern int glthread_create (gl_thread_t *result,
-                                   void *(*func) (void *), void *arg);
-
-   Querying and changing the signal mask of a thread (not supported on all
-   platforms):
-       gl_thread_sigmask (how, newmask, oldmask);
-   Or with control of error handling:
-       err = glthread_sigmask (how, newmask, oldmask);
-       extern int glthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask);
-
-   Waiting for termination of another thread:
-       gl_thread_join (thread, &return_value);
-   Or with control of error handling:
-       err = glthread_join (thread, &return_value);
-       extern int glthread_join (gl_thread_t thread, void **return_value_ptr);
-
-   Getting a reference to the current thread:
-       current = gl_thread_self ();
-       extern gl_thread_t gl_thread_self (void);
-
-   Getting a reference to the current thread as a pointer, for debugging:
-       ptr = gl_thread_self_pointer ();
-       extern void * gl_thread_self_pointer (void);
-
-   Terminating the current thread:
-       gl_thread_exit (return_value);
-       extern _Noreturn void gl_thread_exit (void *return_value);
-
-   Requesting custom code to be executed at fork() time(not supported on all
-   platforms):
-       gl_thread_atfork (prepare_func, parent_func, child_func);
-   Or with control of error handling:
-       err = glthread_atfork (prepare_func, parent_func, child_func);
-       extern int glthread_atfork (void (*prepare_func) (void),
-                                   void (*parent_func) (void),
-                                   void (*child_func) (void));
-   Note that even on platforms where this is supported, use of fork() and
-   threads together is problematic, see
-     <http://lists.gnu.org/archive/html/bug-gnulib/2008-08/msg00062.html>
- */
-
-
-#ifndef _GLTHREAD_THREAD_H
-#define _GLTHREAD_THREAD_H
-
-#include <errno.h>
-#include <stdlib.h>
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library.  */
-
-# include <pthread.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if PTHREAD_IN_USE_DETECTION_HARD
-
-/* The pthread_in_use() detection needs to be done at runtime.  */
-#  define pthread_in_use() \
-     glthread_in_use ()
-extern int glthread_in_use (void);
-
-# endif
-
-# if USE_POSIX_THREADS_WEAK
-
-/* Use weak references to the POSIX threads library.  */
-
-/* Weak references avoid dragging in external libraries if the other parts
-   of the program don't use them.  Here we use them, because we don't want
-   every program that uses libintl to depend on libpthread.  This assumes
-   that libpthread would not be loaded after libintl; i.e. if libintl is
-   loaded first, by an executable that does not depend on libpthread, and
-   then a module is dynamically loaded that depends on libpthread, libintl
-   will not be multithread-safe.  */
-
-/* The way to test at runtime whether libpthread is present is to test
-   whether a function pointer's value, such as &pthread_mutex_init, is
-   non-NULL.  However, some versions of GCC have a bug through which, in
-   PIC mode, &foo != NULL always evaluates to true if there is a direct
-   call to foo(...) in the same function.  To avoid this, we test the
-   address of a function in libpthread that we don't use.  */
-
-#  pragma weak pthread_create
-#  pragma weak pthread_sigmask
-#  pragma weak pthread_join
-#  ifndef pthread_self
-#   pragma weak pthread_self
-#  endif
-#  pragma weak pthread_exit
-#  if HAVE_PTHREAD_ATFORK
-#   pragma weak pthread_atfork
-#  endif
-
-#  if !PTHREAD_IN_USE_DETECTION_HARD
-#   pragma weak pthread_cancel
-#   define pthread_in_use() (pthread_cancel != NULL)
-#  endif
-
-# else
-
-#  if !PTHREAD_IN_USE_DETECTION_HARD
-#   define pthread_in_use() 1
-#  endif
-
-# endif
-
-/* -------------------------- gl_thread_t datatype -------------------------- */
-
-/* This choice of gl_thread_t assumes that
-     pthread_equal (a, b)  is equivalent to  ((a) == (b)).
-   This is the case on all platforms in use in 2008.  */
-typedef pthread_t gl_thread_t;
-# define glthread_create(THREADP, FUNC, ARG) \
-    (pthread_in_use () ? pthread_create (THREADP, NULL, FUNC, ARG) : ENOSYS)
-# define glthread_sigmask(HOW, SET, OSET) \
-    (pthread_in_use () ? pthread_sigmask (HOW, SET, OSET) : 0)
-# define glthread_join(THREAD, RETVALP) \
-    (pthread_in_use () ? pthread_join (THREAD, RETVALP) : 0)
-# ifdef PTW32_VERSION
-   /* In pthreads-win32, pthread_t is a struct with a pointer field 'p' and
-      other fields.  */
-#  define gl_thread_self() \
-     (pthread_in_use () ? pthread_self () : gl_null_thread)
-#  define gl_thread_self_pointer() \
-     (pthread_in_use () ? pthread_self ().p : NULL)
-extern const gl_thread_t gl_null_thread;
-# else
-#  define gl_thread_self() \
-     (pthread_in_use () ? pthread_self () : (pthread_t) NULL)
-#  define gl_thread_self_pointer() \
-     (pthread_in_use () ? (void *) pthread_self () : NULL)
-# endif
-# define gl_thread_exit(RETVAL) \
-    (pthread_in_use () ? pthread_exit (RETVAL) : 0)
-
-# if HAVE_PTHREAD_ATFORK
-#  define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) \
-     (pthread_in_use () ? pthread_atfork (PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) : 0)
-# else
-#  define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
-# endif
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-/* Use the GNU Pth threads library.  */
-
-# include <pth.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if USE_PTH_THREADS_WEAK
-
-/* Use weak references to the GNU Pth threads library.  */
-
-#  pragma weak pth_spawn
-#  pragma weak pth_sigmask
-#  pragma weak pth_join
-#  pragma weak pth_self
-#  pragma weak pth_exit
-
-#  pragma weak pth_cancel
-#  define pth_in_use() (pth_cancel != NULL)
-
-# else
-
-#  define pth_in_use() 1
-
-# endif
-/* -------------------------- gl_thread_t datatype -------------------------- */
-
-typedef pth_t gl_thread_t;
-# define glthread_create(THREADP, FUNC, ARG) \
-    (pth_in_use () ? ((*(THREADP) = pth_spawn (NULL, FUNC, ARG)) ? 0 : errno) : 0)
-# define glthread_sigmask(HOW, SET, OSET) \
-    (pth_in_use () && !pth_sigmask (HOW, SET, OSET) ? errno : 0)
-# define glthread_join(THREAD, RETVALP) \
-    (pth_in_use () && !pth_join (THREAD, RETVALP) ? errno : 0)
-# define gl_thread_self() \
-    (pth_in_use () ? (void *) pth_self () : NULL)
-# define gl_thread_self_pointer() \
-    gl_thread_self ()
-# define gl_thread_exit(RETVAL) \
-    (pth_in_use () ? pth_exit (RETVAL) : 0)
-# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library.  */
-
-# include <thread.h>
-# include <synch.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if USE_SOLARIS_THREADS_WEAK
-
-/* Use weak references to the old Solaris threads library.  */
-
-#  pragma weak thr_create
-#  pragma weak thr_join
-#  pragma weak thr_self
-#  pragma weak thr_exit
-
-#  pragma weak thr_suspend
-#  define thread_in_use() (thr_suspend != NULL)
-
-# else
-
-#  define thread_in_use() 1
-
-# endif
-
-/* -------------------------- gl_thread_t datatype -------------------------- */
-
-typedef thread_t gl_thread_t;
-# define glthread_create(THREADP, FUNC, ARG) \
-    (thread_in_use () ? thr_create (NULL, 0, FUNC, ARG, 0, THREADP) : 0)
-# define glthread_sigmask(HOW, SET, OSET) \
-    (thread_in_use () ? sigprocmask (HOW, SET, OSET) : 0)
-# define glthread_join(THREAD, RETVALP) \
-    (thread_in_use () ? thr_join (THREAD, NULL, RETVALP) : 0)
-# define gl_thread_self() \
-    (thread_in_use () ? (void *) thr_self () : NULL)
-# define gl_thread_self_pointer() \
-    gl_thread_self ()
-# define gl_thread_exit(RETVAL) \
-    (thread_in_use () ? thr_exit (RETVAL) : 0)
-# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WINDOWS_THREADS
-
-# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
-# include <windows.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* -------------------------- gl_thread_t datatype -------------------------- */
-
-/* The gl_thread_t is a pointer to a structure in memory.
-   Why not the thread handle?  If it were the thread handle, it would be hard
-   to implement gl_thread_self() (since GetCurrentThread () returns a pseudo-
-   handle, DuplicateHandle (GetCurrentThread ()) returns a handle that must be
-   closed afterwards, and there is no function for quickly retrieving a thread
-   handle from its id).
-   Why not the thread id?  I tried it.  It did not work: Sometimes ids appeared
-   that did not belong to running threads, and glthread_join failed with ESRCH.
- */
-typedef struct gl_thread_struct *gl_thread_t;
-# define glthread_create(THREADP, FUNC, ARG) \
-    glthread_create_func (THREADP, FUNC, ARG)
-# define glthread_sigmask(HOW, SET, OSET) \
-    /* unsupported */ 0
-# define glthread_join(THREAD, RETVALP) \
-    glthread_join_func (THREAD, RETVALP)
-# define gl_thread_self() \
-    gl_thread_self_func ()
-# define gl_thread_self_pointer() \
-    gl_thread_self ()
-# define gl_thread_exit(RETVAL) \
-    gl_thread_exit_func (RETVAL)
-# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
-extern int glthread_create_func (gl_thread_t *threadp, void * (*func) (void *), void *arg);
-extern int glthread_join_func (gl_thread_t thread, void **retvalp);
-extern gl_thread_t gl_thread_self_func (void);
-extern int gl_thread_exit_func (void *retval);
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WINDOWS_THREADS)
-
-/* Provide dummy implementation if threads are not supported.  */
-
-typedef int gl_thread_t;
-# define glthread_create(THREADP, FUNC, ARG) ENOSYS
-# define glthread_sigmask(HOW, SET, OSET) 0
-# define glthread_join(THREAD, RETVALP) 0
-# define gl_thread_self() 0
-# define gl_thread_self_pointer() \
-    ((void *) gl_thread_self ())
-# define gl_thread_exit(RETVAL) 0
-# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
-
-#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)
-{
-  gl_thread_t thread;
-  int ret;
-
-  ret = glthread_create (&thread, func, arg);
-  if (ret != 0)
-    abort ();
-  return thread;
-}
-#define gl_thread_sigmask(HOW, SET, OSET)     \
-   do                                         \
-     {                                        \
-       if (glthread_sigmask (HOW, SET, OSET)) \
-         abort ();                            \
-     }                                        \
-   while (0)
-#define gl_thread_join(THREAD, RETVAL)     \
-   do                                      \
-     {                                     \
-       if (glthread_join (THREAD, RETVAL)) \
-         abort ();                         \
-     }                                     \
-   while (0)
-#define gl_thread_atfork(PREPARE, PARENT, CHILD)     \
-   do                                                \
-     {                                               \
-       if (glthread_atfork (PREPARE, PARENT, CHILD)) \
-         abort ();                                   \
-     }                                               \
-   while (0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GLTHREAD_THREAD_H */
diff --git a/gl/tests/glthread/yield.h b/gl/tests/glthread/yield.h
deleted file mode 100644 (file)
index 040afe3..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Yielding the processor to other threads and processes.
-   Copyright (C) 2005-2012 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, 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 General Public License for more details.
-
-   You should have received a copy of the GNU 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.  */
-
-/* This file contains a primitive for yielding the processor to other threads.
-     extern void gl_thread_yield (void);
- */
-
-#ifndef _GLTHREAD_YIELD_H
-#define _GLTHREAD_YIELD_H
-
-#include <errno.h>
-
-/* ========================================================================= */
-
-#if USE_POSIX_THREADS
-
-/* Use the POSIX threads library.  */
-
-# include <sched.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# define gl_thread_yield() \
-    sched_yield ()
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_PTH_THREADS
-
-/* Use the GNU Pth threads library.  */
-
-# include <pth.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# define gl_thread_yield() \
-    pth_yield (NULL)
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_SOLARIS_THREADS
-
-/* Use the old Solaris threads library.  */
-
-# include <thread.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# define gl_thread_yield() \
-    thr_yield ()
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if USE_WINDOWS_THREADS
-
-# define WIN32_LEAN_AND_MEAN  /* avoid including junk */
-# include <windows.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# define gl_thread_yield() \
-    Sleep (0)
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif
-
-/* ========================================================================= */
-
-#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WINDOWS_THREADS)
-
-/* Provide dummy implementation if threads are not supported.  */
-
-# define gl_thread_yield() 0
-
-#endif
-
-/* ========================================================================= */
-
-#endif /* _GLTHREAD_YIELD_H */
index 201e130a78619fbca0a8dcfc386ac5815768192e..265ef6493bd49b6daf6e9967eb45ea1afe13e597 100644 (file)
@@ -30,7 +30,7 @@ SIGNATURE_CHECK (accept, int, (int, struct sockaddr *, socklen_t *));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index b4b57391213dc484a107a719dc59aee2351d3d10..e97be2a249e753673bb9be907f68864a689c5a37 100644 (file)
@@ -31,7 +31,7 @@ SIGNATURE_CHECK (bind, int, (int, const struct sockaddr *, socklen_t));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index 6e43bf88f22582c1990f55351468526e207cf8b7..9ef892390de31a889cbd378c540653dd3beb2b6e 100644 (file)
@@ -31,7 +31,7 @@ SIGNATURE_CHECK (connect, int, (int, const struct sockaddr *, socklen_t));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index f15b32f1cc672720ed7d09a1ec3d06d06ffa0ade..b0545c634cce42ccb2b571b713fd4676b3cbca39 100644 (file)
@@ -30,7 +30,7 @@ SIGNATURE_CHECK (getpeername, int, (int, struct sockaddr *, socklen_t *));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index d35e9b34c3046a63d7582db4fb6619bea7322686..aa058b0398bf4d0e2be21f8f24cef666bf2bd84b 100644 (file)
@@ -19,4 +19,3 @@
 #include "isnand-nolibm.h"
 
 #include "test-isnand.h"
-
index 3ea82d4bace4746eaecc1b7f79f8426f48547a2b..b81558a54712dc921de3ddbcc90625d6b2e837d9 100644 (file)
@@ -29,7 +29,7 @@ SIGNATURE_CHECK (listen, int, (int, int));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
diff --git a/gl/tests/test-lock.c b/gl/tests/test-lock.c
deleted file mode 100644 (file)
index 06bb3df..0000000
+++ /dev/null
@@ -1,601 +0,0 @@
-/* Test of locking in multithreaded situations.
-   Copyright (C) 2005, 2008-2012 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, 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 General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2005.  */
-
-#include <config.h>
-
-#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS
-
-#if USE_POSIX_THREADS
-# define TEST_POSIX_THREADS 1
-#endif
-#if USE_SOLARIS_THREADS
-# define TEST_SOLARIS_THREADS 1
-#endif
-#if USE_PTH_THREADS
-# define TEST_PTH_THREADS 1
-#endif
-#if USE_WINDOWS_THREADS
-# define TEST_WINDOWS_THREADS 1
-#endif
-
-/* Whether to enable locking.
-   Uncomment this to get a test program without locking, to verify that
-   it crashes.  */
-#define ENABLE_LOCKING 1
-
-/* Which tests to perform.
-   Uncomment some of these, to verify that all tests crash if no locking
-   is enabled.  */
-#define DO_TEST_LOCK 1
-#define DO_TEST_RWLOCK 1
-#define DO_TEST_RECURSIVE_LOCK 1
-#define DO_TEST_ONCE 1
-
-/* Whether to help the scheduler through explicit yield().
-   Uncomment this to see if the operating system has a fair scheduler.  */
-#define EXPLICIT_YIELD 1
-
-/* Whether to print debugging messages.  */
-#define ENABLE_DEBUGGING 0
-
-/* Number of simultaneous threads.  */
-#define THREAD_COUNT 10
-
-/* Number of operations performed in each thread.
-   This is quite high, because with a smaller count, say 5000, we often get
-   an "OK" result even without ENABLE_LOCKING (on Linux/x86).  */
-#define REPEAT_COUNT 50000
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if !ENABLE_LOCKING
-# undef USE_POSIX_THREADS
-# undef USE_SOLARIS_THREADS
-# undef USE_PTH_THREADS
-# undef USE_WINDOWS_THREADS
-#endif
-#include "glthread/lock.h"
-
-#if !ENABLE_LOCKING
-# if TEST_POSIX_THREADS
-#  define USE_POSIX_THREADS 1
-# endif
-# if TEST_SOLARIS_THREADS
-#  define USE_SOLARIS_THREADS 1
-# endif
-# if TEST_PTH_THREADS
-#  define USE_PTH_THREADS 1
-# endif
-# if TEST_WINDOWS_THREADS
-#  define USE_WINDOWS_THREADS 1
-# endif
-#endif
-
-#include "glthread/thread.h"
-#include "glthread/yield.h"
-
-#if ENABLE_DEBUGGING
-# define dbgprintf printf
-#else
-# define dbgprintf if (0) printf
-#endif
-
-#if EXPLICIT_YIELD
-# define yield() gl_thread_yield ()
-#else
-# define yield()
-#endif
-
-#define ACCOUNT_COUNT 4
-
-static int account[ACCOUNT_COUNT];
-
-static int
-random_account (void)
-{
-  return ((unsigned int) rand () >> 3) % ACCOUNT_COUNT;
-}
-
-static void
-check_accounts (void)
-{
-  int i, sum;
-
-  sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
-    sum += account[i];
-  if (sum != ACCOUNT_COUNT * 1000)
-    abort ();
-}
-
-
-/* ------------------- Test normal (non-recursive) locks ------------------- */
-
-/* Test normal locks by having several bank accounts and several threads
-   which shuffle around money between the accounts and another thread
-   checking that all the money is still there.  */
-
-gl_lock_define_initialized(static, my_lock)
-
-static void *
-lock_mutator_thread (void *arg)
-{
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
-    {
-      int i1, i2, value;
-
-      dbgprintf ("Mutator %p before lock\n", gl_thread_self_pointer ());
-      gl_lock_lock (my_lock);
-      dbgprintf ("Mutator %p after  lock\n", gl_thread_self_pointer ());
-
-      i1 = random_account ();
-      i2 = random_account ();
-      value = ((unsigned int) rand () >> 3) % 10;
-      account[i1] += value;
-      account[i2] -= value;
-
-      dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
-      gl_lock_unlock (my_lock);
-      dbgprintf ("Mutator %p after  unlock\n", gl_thread_self_pointer ());
-
-      dbgprintf ("Mutator %p before check lock\n", gl_thread_self_pointer ());
-      gl_lock_lock (my_lock);
-      check_accounts ();
-      gl_lock_unlock (my_lock);
-      dbgprintf ("Mutator %p after  check unlock\n", gl_thread_self_pointer ());
-
-      yield ();
-    }
-
-  dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
-  return NULL;
-}
-
-static volatile int lock_checker_done;
-
-static void *
-lock_checker_thread (void *arg)
-{
-  while (!lock_checker_done)
-    {
-      dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
-      gl_lock_lock (my_lock);
-      check_accounts ();
-      gl_lock_unlock (my_lock);
-      dbgprintf ("Checker %p after  check unlock\n", gl_thread_self_pointer ());
-
-      yield ();
-    }
-
-  dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
-  return NULL;
-}
-
-static void
-test_lock (void)
-{
-  int i;
-  gl_thread_t checkerthread;
-  gl_thread_t threads[THREAD_COUNT];
-
-  /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
-    account[i] = 1000;
-  lock_checker_done = 0;
-
-  /* Spawn the threads.  */
-  checkerthread = gl_thread_create (lock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
-    threads[i] = gl_thread_create (lock_mutator_thread, NULL);
-
-  /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
-    gl_thread_join (threads[i], NULL);
-  lock_checker_done = 1;
-  gl_thread_join (checkerthread, NULL);
-  check_accounts ();
-}
-
-
-/* ----------------- Test read-write (non-recursive) locks ----------------- */
-
-/* Test read-write locks by having several bank accounts and several threads
-   which shuffle around money between the accounts and several other threads
-   that check that all the money is still there.  */
-
-gl_rwlock_define_initialized(static, my_rwlock)
-
-static void *
-rwlock_mutator_thread (void *arg)
-{
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
-    {
-      int i1, i2, value;
-
-      dbgprintf ("Mutator %p before wrlock\n", gl_thread_self_pointer ());
-      gl_rwlock_wrlock (my_rwlock);
-      dbgprintf ("Mutator %p after  wrlock\n", gl_thread_self_pointer ());
-
-      i1 = random_account ();
-      i2 = random_account ();
-      value = ((unsigned int) rand () >> 3) % 10;
-      account[i1] += value;
-      account[i2] -= value;
-
-      dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
-      gl_rwlock_unlock (my_rwlock);
-      dbgprintf ("Mutator %p after  unlock\n", gl_thread_self_pointer ());
-
-      yield ();
-    }
-
-  dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
-  return NULL;
-}
-
-static volatile int rwlock_checker_done;
-
-static void *
-rwlock_checker_thread (void *arg)
-{
-  while (!rwlock_checker_done)
-    {
-      dbgprintf ("Checker %p before check rdlock\n", gl_thread_self_pointer ());
-      gl_rwlock_rdlock (my_rwlock);
-      check_accounts ();
-      gl_rwlock_unlock (my_rwlock);
-      dbgprintf ("Checker %p after  check unlock\n", gl_thread_self_pointer ());
-
-      yield ();
-    }
-
-  dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
-  return NULL;
-}
-
-static void
-test_rwlock (void)
-{
-  int i;
-  gl_thread_t checkerthreads[THREAD_COUNT];
-  gl_thread_t threads[THREAD_COUNT];
-
-  /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
-    account[i] = 1000;
-  rwlock_checker_done = 0;
-
-  /* Spawn the threads.  */
-  for (i = 0; i < THREAD_COUNT; i++)
-    checkerthreads[i] = gl_thread_create (rwlock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
-    threads[i] = gl_thread_create (rwlock_mutator_thread, NULL);
-
-  /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
-    gl_thread_join (threads[i], NULL);
-  rwlock_checker_done = 1;
-  for (i = 0; i < THREAD_COUNT; i++)
-    gl_thread_join (checkerthreads[i], NULL);
-  check_accounts ();
-}
-
-
-/* -------------------------- Test recursive locks -------------------------- */
-
-/* Test recursive locks by having several bank accounts and several threads
-   which shuffle around money between the accounts (recursively) and another
-   thread checking that all the money is still there.  */
-
-gl_recursive_lock_define_initialized(static, my_reclock)
-
-static void
-recshuffle (void)
-{
-  int i1, i2, value;
-
-  dbgprintf ("Mutator %p before lock\n", gl_thread_self_pointer ());
-  gl_recursive_lock_lock (my_reclock);
-  dbgprintf ("Mutator %p after  lock\n", gl_thread_self_pointer ());
-
-  i1 = random_account ();
-  i2 = random_account ();
-  value = ((unsigned int) rand () >> 3) % 10;
-  account[i1] += value;
-  account[i2] -= value;
-
-  /* Recursive with probability 0.5.  */
-  if (((unsigned int) rand () >> 3) % 2)
-    recshuffle ();
-
-  dbgprintf ("Mutator %p before unlock\n", gl_thread_self_pointer ());
-  gl_recursive_lock_unlock (my_reclock);
-  dbgprintf ("Mutator %p after  unlock\n", gl_thread_self_pointer ());
-}
-
-static void *
-reclock_mutator_thread (void *arg)
-{
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
-    {
-      recshuffle ();
-
-      dbgprintf ("Mutator %p before check lock\n", gl_thread_self_pointer ());
-      gl_recursive_lock_lock (my_reclock);
-      check_accounts ();
-      gl_recursive_lock_unlock (my_reclock);
-      dbgprintf ("Mutator %p after  check unlock\n", gl_thread_self_pointer ());
-
-      yield ();
-    }
-
-  dbgprintf ("Mutator %p dying.\n", gl_thread_self_pointer ());
-  return NULL;
-}
-
-static volatile int reclock_checker_done;
-
-static void *
-reclock_checker_thread (void *arg)
-{
-  while (!reclock_checker_done)
-    {
-      dbgprintf ("Checker %p before check lock\n", gl_thread_self_pointer ());
-      gl_recursive_lock_lock (my_reclock);
-      check_accounts ();
-      gl_recursive_lock_unlock (my_reclock);
-      dbgprintf ("Checker %p after  check unlock\n", gl_thread_self_pointer ());
-
-      yield ();
-    }
-
-  dbgprintf ("Checker %p dying.\n", gl_thread_self_pointer ());
-  return NULL;
-}
-
-static void
-test_recursive_lock (void)
-{
-  int i;
-  gl_thread_t checkerthread;
-  gl_thread_t threads[THREAD_COUNT];
-
-  /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
-    account[i] = 1000;
-  reclock_checker_done = 0;
-
-  /* Spawn the threads.  */
-  checkerthread = gl_thread_create (reclock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
-    threads[i] = gl_thread_create (reclock_mutator_thread, NULL);
-
-  /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
-    gl_thread_join (threads[i], NULL);
-  reclock_checker_done = 1;
-  gl_thread_join (checkerthread, NULL);
-  check_accounts ();
-}
-
-
-/* ------------------------ Test once-only execution ------------------------ */
-
-/* Test once-only execution by having several threads attempt to grab a
-   once-only task simultaneously (triggered by releasing a read-write lock).  */
-
-gl_once_define(static, fresh_once)
-static int ready[THREAD_COUNT];
-static gl_lock_t ready_lock[THREAD_COUNT];
-#if ENABLE_LOCKING
-static gl_rwlock_t fire_signal[REPEAT_COUNT];
-#else
-static volatile int fire_signal_state;
-#endif
-static gl_once_t once_control;
-static int performed;
-gl_lock_define_initialized(static, performed_lock)
-
-static void
-once_execute (void)
-{
-  gl_lock_lock (performed_lock);
-  performed++;
-  gl_lock_unlock (performed_lock);
-}
-
-static void *
-once_contender_thread (void *arg)
-{
-  int id = (int) (long) arg;
-  int repeat;
-
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
-    {
-      /* Tell the main thread that we're ready.  */
-      gl_lock_lock (ready_lock[id]);
-      ready[id] = 1;
-      gl_lock_unlock (ready_lock[id]);
-
-      if (repeat == REPEAT_COUNT)
-        break;
-
-      dbgprintf ("Contender %p waiting for signal for round %d\n",
-                 gl_thread_self_pointer (), repeat);
-#if ENABLE_LOCKING
-      /* Wait for the signal to go.  */
-      gl_rwlock_rdlock (fire_signal[repeat]);
-      /* And don't hinder the others (if the scheduler is unfair).  */
-      gl_rwlock_unlock (fire_signal[repeat]);
-#else
-      /* Wait for the signal to go.  */
-      while (fire_signal_state <= repeat)
-        yield ();
-#endif
-      dbgprintf ("Contender %p got the     signal for round %d\n",
-                 gl_thread_self_pointer (), repeat);
-
-      /* Contend for execution.  */
-      gl_once (once_control, once_execute);
-    }
-
-  return NULL;
-}
-
-static void
-test_once (void)
-{
-  int i, repeat;
-  gl_thread_t threads[THREAD_COUNT];
-
-  /* Initialize all variables.  */
-  for (i = 0; i < THREAD_COUNT; i++)
-    {
-      ready[i] = 0;
-      gl_lock_init (ready_lock[i]);
-    }
-#if ENABLE_LOCKING
-  for (i = 0; i < REPEAT_COUNT; i++)
-    gl_rwlock_init (fire_signal[i]);
-#else
-  fire_signal_state = 0;
-#endif
-
-  /* Block all fire_signals.  */
-  for (i = REPEAT_COUNT-1; i >= 0; i--)
-    gl_rwlock_wrlock (fire_signal[i]);
-
-  /* Spawn the threads.  */
-  for (i = 0; i < THREAD_COUNT; i++)
-    threads[i] = gl_thread_create (once_contender_thread, (void *) (long) i);
-
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
-    {
-      /* Wait until every thread is ready.  */
-      dbgprintf ("Main thread before synchonizing for round %d\n", repeat);
-      for (;;)
-        {
-          int ready_count = 0;
-          for (i = 0; i < THREAD_COUNT; i++)
-            {
-              gl_lock_lock (ready_lock[i]);
-              ready_count += ready[i];
-              gl_lock_unlock (ready_lock[i]);
-            }
-          if (ready_count == THREAD_COUNT)
-            break;
-          yield ();
-        }
-      dbgprintf ("Main thread after  synchonizing for round %d\n", repeat);
-
-      if (repeat > 0)
-        {
-          /* Check that exactly one thread executed the once_execute()
-             function.  */
-          if (performed != 1)
-            abort ();
-        }
-
-      if (repeat == REPEAT_COUNT)
-        break;
-
-      /* Preparation for the next round: Initialize once_control.  */
-      memcpy (&once_control, &fresh_once, sizeof (gl_once_t));
-
-      /* Preparation for the next round: Reset the performed counter.  */
-      performed = 0;
-
-      /* Preparation for the next round: Reset the ready flags.  */
-      for (i = 0; i < THREAD_COUNT; i++)
-        {
-          gl_lock_lock (ready_lock[i]);
-          ready[i] = 0;
-          gl_lock_unlock (ready_lock[i]);
-        }
-
-      /* Signal all threads simultaneously.  */
-      dbgprintf ("Main thread giving signal for round %d\n", repeat);
-#if ENABLE_LOCKING
-      gl_rwlock_unlock (fire_signal[repeat]);
-#else
-      fire_signal_state = repeat + 1;
-#endif
-    }
-
-  /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
-    gl_thread_join (threads[i], NULL);
-}
-
-
-/* -------------------------------------------------------------------------- */
-
-int
-main ()
-{
-#if TEST_PTH_THREADS
-  if (!pth_init ())
-    abort ();
-#endif
-
-#if DO_TEST_LOCK
-  printf ("Starting test_lock ..."); fflush (stdout);
-  test_lock ();
-  printf (" OK\n"); fflush (stdout);
-#endif
-#if DO_TEST_RWLOCK
-  printf ("Starting test_rwlock ..."); fflush (stdout);
-  test_rwlock ();
-  printf (" OK\n"); fflush (stdout);
-#endif
-#if DO_TEST_RECURSIVE_LOCK
-  printf ("Starting test_recursive_lock ..."); fflush (stdout);
-  test_recursive_lock ();
-  printf (" OK\n"); fflush (stdout);
-#endif
-#if DO_TEST_ONCE
-  printf ("Starting test_once ..."); fflush (stdout);
-  test_once ();
-  printf (" OK\n"); fflush (stdout);
-#endif
-
-  return 0;
-}
-
-#else
-
-/* No multithreading available.  */
-
-#include <stdio.h>
-
-int
-main ()
-{
-  fputs ("Skipping test: multithreading not enabled\n", stderr);
-  return 77;
-}
-
-#endif
index a147d5d1b8455145adf7a95ed82f7c42b75f5935..2186b8eabbdf7a133d75f8a9be0e61a4af06d967 100644 (file)
@@ -29,7 +29,7 @@ SIGNATURE_CHECK (recv, ssize_t, (int, void *, size_t, int));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index 144762039eae00a4445699d569cded3b9dd4587d..7f6f6f67b6d8d81f7958936e1221f6ed8ce84d7e 100644 (file)
@@ -32,7 +32,7 @@ SIGNATURE_CHECK (recvfrom, ssize_t,
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index febbe20a0454adc92260fe8d7b631be90a606828..7b068d1c13c36e02efd4fce0a69a73d16f1b91f1 100644 (file)
@@ -29,7 +29,7 @@ SIGNATURE_CHECK (send, ssize_t, (int, const void *, size_t, int));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index 88fad93f13071303997564836c22bf52f2febb17..1d0e4101d763cde629a2c925a1f2a655940e88ce 100644 (file)
@@ -33,7 +33,7 @@ SIGNATURE_CHECK (sendto, ssize_t,
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index cc78a1bc8fff9d4ac82bd856448b0e532c88d38a..c14d217a7c958622a8b782466658fc762eb2b897 100644 (file)
@@ -29,7 +29,7 @@ SIGNATURE_CHECK (setsockopt, int, (int, int, int, const void *, socklen_t));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
index 91d979a60b7b89cd784130a16f67a8cdbfdfd56b..be9f55005ababb8c4e167c9850f1a65a2d0f5e9c 100644 (file)
@@ -29,7 +29,7 @@ SIGNATURE_CHECK (shutdown, int, (int, int));
 int
 main (void)
 {
-  gl_sockets_startup (SOCKETS_1_1);
+  (void) gl_sockets_startup (SOCKETS_1_1);
 
   /* Test behaviour for invalid file descriptors.  */
   {
diff --git a/gl/tests/test-thread_create.c b/gl/tests/test-thread_create.c
deleted file mode 100644 (file)
index 0f86771..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Test of gl_thread_create () macro.
-   Copyright (C) 2011-2012 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, 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 General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
-
-#include <config.h>
-
-#include "glthread/thread.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include "macros.h"
-
-static gl_thread_t main_thread_before;
-static gl_thread_t main_thread_after;
-static gl_thread_t worker_thread;
-
-static int dummy;
-static volatile int work_done;
-
-static void *
-worker_thread_func (void *arg)
-{
-  work_done = 1;
-  return &dummy;
-}
-
-int
-main ()
-{
-  main_thread_before = gl_thread_self ();
-
-  if (glthread_create (&worker_thread, worker_thread_func, NULL) == 0)
-    {
-      void *ret;
-
-      /* Check that gl_thread_self () has the same value before than after the
-         first call to gl_thread_create ().  */
-      main_thread_after = gl_thread_self ();
-      ASSERT (memcmp (&main_thread_before, &main_thread_after,
-                      sizeof (gl_thread_t))
-              == 0);
-
-      gl_thread_join (worker_thread, &ret);
-
-      /* Check the return value of the thread.  */
-      ASSERT (ret == &dummy);
-
-      /* Check that worker_thread_func () has finished executing.  */
-      ASSERT (work_done);
-
-      return 0;
-    }
-  else
-    {
-#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || USE_WINDOWS_THREADS
-      fputs ("glthread_create failed\n", stderr);
-      return 1;
-#else
-      fputs ("Skipping test: multithreading not enabled\n", stderr);
-      return 77;
-#endif
-    }
-}
diff --git a/gl/tests/test-thread_self.c b/gl/tests/test-thread_self.c
deleted file mode 100644 (file)
index 707f7fe..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Test of gl_thread_self () macro.
-   Copyright (C) 2011-2012 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, 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 General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
-
-#include <config.h>
-
-#include "glthread/thread.h"
-
-gl_thread_t main_thread;
-
-int
-main ()
-{
-  /* Check that gl_thread_self () can be used with just $(LIBTHREAD), not
-     $(LIBMULTITHREAD), i.e. in libraries that are multithread-safe but don't
-     create threads themselves.  */
-  main_thread = gl_thread_self ();
-
-  return 0;
-}
index ad6aac7ed7755d4b1ed3ea1a019782119ce70a09..266865526911e9f9795bde6276ac67a2f79cec28 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -502,7 +502,7 @@ sc_prohibit_same_without_use:
 
 sc_prohibit_hash_pjw_without_use:
        @h='hash-pjw.h' \
-       re='\<hash_pjw *\(' \
+       re='\<hash_pjw\>' \
          $(_sc_header_without_use)
 
 sc_prohibit_safe_read_without_use: