about summary refs log tree commit diff
path: root/nptl/tst-mutex5.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-24 06:36:06 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-24 06:36:06 +0000
commit2c0b891afe29dd28d0e6d75e0da8681db7fd100d (patch)
tree06fead8fc58acefbe9a9ebe353f0d596e73522ad /nptl/tst-mutex5.c
parent565699e492f741bc4563c73046f457924c6f708a (diff)
downloadglibc-2c0b891afe29dd28d0e6d75e0da8681db7fd100d.tar.gz
glibc-2c0b891afe29dd28d0e6d75e0da8681db7fd100d.tar.xz
glibc-2c0b891afe29dd28d0e6d75e0da8681db7fd100d.zip
Update.
	* sysdeps/unix/sysv/linux/smp.h: New file.
	* sysdeps/unix/sysv/linux/sh/smp.h: New file.
	* init.c: Define __is_smp.
	(__pthread_initialize_minimal_internal): Call is_smp_system to
	initialize __is_smp.
	* pthreadP.h: Declare __is_smp.
	Define MAX_ADAPTIVE_COUNT is necessary.
	* pthread_mutex_init.c: Add comment regarding __spins field.
	* pthread_mutex_lock.c: Implement adaptive mutex type.
	* pthread_mutex_timedlock.c: Likewise.
	* sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_mutex_t):
	Add __spins field.
	* sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Define
	lll_mutex_cond_trylock.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Likewise.
	Define BUSY_WAIT_NOP.
	* sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Likewise.

	* tst-mutex5.c: Add support for testing adaptive mutexes.
	* tst-mutex7.c: Likewise.
	* tst-mutex5a.c: New file.
	* tst-mutex7a.c: New file.
	* Makefile (tests): Add tst-mutex5a and tst-mutex7a.
Diffstat (limited to 'nptl/tst-mutex5.c')
-rw-r--r--nptl/tst-mutex5.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/nptl/tst-mutex5.c b/nptl/tst-mutex5.c
index a615012507..eb35b78d36 100644
--- a/nptl/tst-mutex5.c
+++ b/nptl/tst-mutex5.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -25,6 +25,11 @@
 #include <sys/time.h>
 
 
+#ifndef TYPE
+# define TYPE PTHREAD_MUTEX_NORMAL
+#endif
+
+
 static int
 do_test (void)
 {
@@ -33,13 +38,32 @@ do_test (void)
   struct timeval tv;
   struct timeval tv2;
   int err;
+  pthread_mutexattr_t a;
+
+  if (pthread_mutexattr_init (&a) != 0)
+    {
+      puts ("mutexattr_init failed");
+      return 1;
+    }
+
+  if (pthread_mutexattr_settype (&a, TYPE) != 0)
+    {
+      puts ("mutexattr_settype failed");
+      return 1;
+    }
 
-  if (pthread_mutex_init (&m, NULL) != 0)
+  if (pthread_mutex_init (&m, &a) != 0)
     {
       puts ("mutex_init failed");
       return 1;
     }
 
+  if (pthread_mutexattr_destroy (&a) != 0)
+    {
+      puts ("mutexattr_destroy failed");
+      return 1;
+    }
+
   if (pthread_mutex_lock (&m) != 0)
     {
       puts ("mutex_lock failed");