diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 36 | ||||
| -rw-r--r-- | tests/GNUmakefile | 11 | ||||
| -rw-r--r-- | tests/Makefile | 9 | ||||
| -rw-r--r-- | tests/mutex2e.c | 66 | ||||
| -rw-r--r-- | tests/mutex2r.c | 66 | ||||
| -rw-r--r-- | tests/mutex3e.c | 75 | ||||
| -rw-r--r-- | tests/mutex3r.c | 75 | ||||
| -rw-r--r-- | tests/mutex6es.c | 94 | ||||
| -rw-r--r-- | tests/mutex6rs.c | 92 | ||||
| -rw-r--r-- | tests/mutex6s.c | 93 | 
10 files changed, 603 insertions, 14 deletions
| diff --git a/tests/ChangeLog b/tests/ChangeLog index f10e570..09a7b50 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,20 +1,30 @@ -2004-05-21  Ross Johnson  <ross@special.ise.canberra.edu.au> +2004-06-21  Ross Johnson  <rpj@callisto.canberra.edu.au>
 -	* join3.c: New test. +	* mutex2r.c: New test.
 +	* mutex2e.c: New test.
 +	* mutex3r.c: New test.
 +	* mutex3e.c: New test.
 +	* mutex6s.c: New test.
 +	* mutex6rs.c: New test.
 +	* mutex6es.c: New test.
 + +2004-05-21  Ross Johnson  <rpj@callisto.canberra.edu.au>
 + +	* join3.c: New test.
  2004-05-16  Ross Johnson  <rpj@callisto.canberra.edu.au>
 -	* condvar2.c (WIN32_WINNT): Define to avoid redefinition warning -	from inclusion of implement.h. -	* convar2_1.c: Likewise. -	* condvar3_1.c: Likewise. -	* condvar3_2.c: Likewise. -	* context1.c: Likewise. -	* sizes.c: Likewise. -	* Makefile: Don't define _WIN32_WINNT on compiler command line. -	* GNUmakefile: Likewise. -	* priority1.c (main): Add column to output for actual win32 -	priority. +	* condvar2.c (WIN32_WINNT): Define to avoid redefinition warning
 +	from inclusion of implement.h.
 +	* convar2_1.c: Likewise.
 +	* condvar3_1.c: Likewise.
 +	* condvar3_2.c: Likewise.
 +	* context1.c: Likewise.
 +	* sizes.c: Likewise.
 +	* Makefile: Don't define _WIN32_WINNT on compiler command line.
 +	* GNUmakefile: Likewise.
 +	* priority1.c (main): Add column to output for actual win32
 +	priority.
  2004-05-16  Ross Johnson  <rpj@callisto.canberra.edu.au>
 diff --git a/tests/GNUmakefile b/tests/GNUmakefile index b9a5e5c..323f24b 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -76,7 +76,9 @@ TESTS	= sizes loadfree \  	  kill1 valid1 valid2 \  	  exit2 exit3 exit4 exit5 \  	  join0 join1 join2 join3 \ -	  mutex2 mutex3 mutex4 mutex6 mutex6n mutex6e mutex6r \ +	  mutex2 mutex2r mutex2e mutex3 mutex3r mutex3e \ +	  mutex4 mutex6 mutex6n mutex6e mutex6r \ +	  mutex6s mutex6es mutex6rs \  	  mutex7 mutex7n mutex7e mutex7r mutex8 mutex8n mutex8e mutex8r \  	  count1 once1 tsd1 self2 cancel1 cancel2 \  	  delay1 delay2 eyal1 \ @@ -203,13 +205,20 @@ mutex1n.pass: mutex1.pass  mutex1e.pass: mutex1.pass  mutex1r.pass: mutex1.pass  mutex2.pass: mutex1.pass +mutex2r.pass: mutex2.pass +mutex2e.pass: mutex2.pass  mutex3.pass: create1.pass +mutex3r.pass: mutex3.pass +mutex3e.pass: mutex3.pass  mutex4.pass: mutex3.pass  mutex5.pass:  mutex6.pass: mutex4.pass  mutex6n.pass: mutex4.pass  mutex6e.pass: mutex4.pass  mutex6r.pass: mutex4.pass +mutex6s.pass: mutex6.pass +mutex6rs.pass: mutex6r.pass +mutex6es.pass: mutex6e.pass  mutex7.pass: mutex6.pass  mutex7n.pass: mutex6n.pass  mutex7e.pass: mutex6e.pass diff --git a/tests/Makefile b/tests/Makefile index 4a70b84..6aefab7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -82,12 +82,14 @@ EHFLAGS	=  PASSES= sizes.pass  loadfree.pass \
  	  semaphore1.pass  semaphore2.pass  self1.pass  mutex5.pass  \
  	  mutex1.pass  mutex1n.pass  mutex1e.pass  mutex1r.pass  mutex2.pass  mutex3.pass  \
 +	  mutex2r.pass  mutex2e.pass  mutex3r.pass  mutex3e.pass  \
  	  condvar1.pass  condvar1_1.pass  condvar1_2.pass  condvar2.pass  condvar2_1.pass  \
  	  exit1.pass  create1.pass  create2.pass  reuse1.pass  reuse2.pass  equal1.pass  \
  	  kill1.pass  valid1.pass  valid2.pass  \
  	  exit2.pass  exit3.pass  exit4  exit5  \
  	  join0.pass  join1.pass  join2.pass join3.pass  \
  	  mutex4.pass  mutex6.pass  mutex6n.pass  mutex6e.pass  mutex6r.pass  \
 +	  mutex6s.pass  mutex6es.pass  mutex6rs.pass  \
  	  mutex7.pass  mutex7n.pass  mutex7e.pass  mutex7r.pass  \
  	  mutex8.pass  mutex8n.pass  mutex8e.pass  mutex8r.pass  \
  	  count1.pass  once1.pass  tsd1.pass  \
 @@ -287,13 +289,20 @@ mutex1n.pass: mutex1.pass  mutex1e.pass: mutex1.pass
  mutex1r.pass: mutex1.pass
  mutex2.pass: mutex1.pass
 +mutex2r.pass: mutex2.pass
 +mutex2e.pass: mutex2.pass
  mutex3.pass: create1.pass
 +mutex3r.pass: mutex3.pass
 +mutex3e.pass: mutex3.pass
  mutex4.pass: mutex3.pass
  mutex5.pass:
  mutex6.pass: mutex4.pass
  mutex6n.pass: mutex4.pass
  mutex6e.pass: mutex4.pass
  mutex6r.pass: mutex4.pass
 +mutex6s.pass: mutex6.pass
 +mutex6rs.pass: mutex6r.pass
 +mutex6es.pass: mutex6e.pass
  mutex7.pass: mutex6.pass
  mutex7n.pass: mutex6n.pass
  mutex7e.pass: mutex6e.pass
 diff --git a/tests/mutex2e.c b/tests/mutex2e.c new file mode 100644 index 0000000..6448204 --- /dev/null +++ b/tests/mutex2e.c @@ -0,0 +1,66 @@ +/*  + * mutex2e.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library 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 + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Declare a static mutex object, lock it,  + * and then unlock it again. + * + * Depends on API functions:  + *	pthread_mutex_lock() + *	pthread_mutex_unlock() + */ + +#include "test.h" +  +pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; + +int +main() +{ +  assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); + +  assert(pthread_mutex_lock(&mutex) == 0); + +  assert(mutex != PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); + +  assert(mutex != NULL); + +  assert(pthread_mutex_unlock(&mutex) == 0); + +  assert(pthread_mutex_destroy(&mutex) == 0); + +  assert(mutex == NULL); + +  return 0; +} diff --git a/tests/mutex2r.c b/tests/mutex2r.c new file mode 100644 index 0000000..9317a6e --- /dev/null +++ b/tests/mutex2r.c @@ -0,0 +1,66 @@ +/*  + * mutex2r.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library 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 + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Declare a static mutex object, lock it,  + * and then unlock it again. + * + * Depends on API functions:  + *	pthread_mutex_lock() + *	pthread_mutex_unlock() + */ + +#include "test.h" +  +pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; + +int +main() +{ +  assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER); + +  assert(pthread_mutex_lock(&mutex) == 0); + +  assert(mutex != PTHREAD_RECURSIVE_MUTEX_INITIALIZER); + +  assert(mutex != NULL); + +  assert(pthread_mutex_unlock(&mutex) == 0); + +  assert(pthread_mutex_destroy(&mutex) == 0); + +  assert(mutex == NULL); + +  return 0; +} diff --git a/tests/mutex3e.c b/tests/mutex3e.c new file mode 100644 index 0000000..271fe6e --- /dev/null +++ b/tests/mutex3e.c @@ -0,0 +1,75 @@ +/*  + * mutex3e.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library 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 + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Declare a static mutex object, lock it, trylock it,  + * and then unlock it again. + * + * Depends on API functions:  + *	pthread_mutex_lock() + *	pthread_mutex_trylock() + *	pthread_mutex_unlock() + */ + +#include "test.h" +  +pthread_mutex_t mutex1 = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; + +static int washere = 0; + +void * func(void * arg) +{ +  assert(pthread_mutex_trylock(&mutex1) == EBUSY); + +  washere = 1; + +  return 0;  +} +  +int +main() +{ +  pthread_t t; + +  assert(pthread_mutex_lock(&mutex1) == 0); + +  assert(pthread_create(&t, NULL, func, NULL) == 0); +  assert(pthread_join(t, NULL) == 0); + +  assert(pthread_mutex_unlock(&mutex1) == 0); + +  assert(washere == 1); + +  return 0; +} diff --git a/tests/mutex3r.c b/tests/mutex3r.c new file mode 100644 index 0000000..8ff6a73 --- /dev/null +++ b/tests/mutex3r.c @@ -0,0 +1,75 @@ +/*  + * mutex3r.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library 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 + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Declare a static mutex object, lock it, trylock it,  + * and then unlock it again. + * + * Depends on API functions:  + *	pthread_mutex_lock() + *	pthread_mutex_trylock() + *	pthread_mutex_unlock() + */ + +#include "test.h" +  +pthread_mutex_t mutex1 = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; + +static int washere = 0; + +void * func(void * arg) +{ +  assert(pthread_mutex_trylock(&mutex1) == EBUSY); + +  washere = 1; + +  return 0;  +} +  +int +main() +{ +  pthread_t t; + +  assert(pthread_mutex_lock(&mutex1) == 0); + +  assert(pthread_create(&t, NULL, func, NULL) == 0); +  assert(pthread_join(t, NULL) == 0); + +  assert(pthread_mutex_unlock(&mutex1) == 0); + +  assert(washere == 1); + +  return 0; +} diff --git a/tests/mutex6es.c b/tests/mutex6es.c new file mode 100644 index 0000000..d59a1c8 --- /dev/null +++ b/tests/mutex6es.c @@ -0,0 +1,94 @@ +/*  + * mutex6es.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library 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 + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Tests PTHREAD_MUTEX_ERRORCHECK static mutex type. + * Thread locks mutex twice (recursive lock). + * This should fail with an EDEADLK error. + * The second unlock attempt should fail with an EPERM error. + * + * Depends on API functions:  + *      pthread_create() + *      pthread_join() + *      pthread_mutexattr_init() + *      pthread_mutexattr_destroy() + *      pthread_mutexattr_settype() + *      pthread_mutexattr_gettype() + *      pthread_mutex_init() + *      pthread_mutex_destroy() + *	pthread_mutex_lock() + *	pthread_mutex_unlock() + */ + +#include "test.h" + +static int lockCount = 0; + +static pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; + +void * locker(void * arg) +{ +  assert(pthread_mutex_lock(&mutex) == 0); +  lockCount++; +  assert(pthread_mutex_lock(&mutex) == EDEADLK); +  lockCount++; +  assert(pthread_mutex_unlock(&mutex) == 0); +  assert(pthread_mutex_unlock(&mutex) == EPERM); + +  return (void *) 555; +} +  +int +main() +{ +  pthread_t t; +  int result = 0; + +  assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); + +  assert(pthread_create(&t, NULL, locker, NULL) == 0); + +  assert(pthread_join(t, (void **) &result) == 0); +  assert(result == 555); + +  assert(lockCount == 2); + +  assert(pthread_mutex_destroy(&mutex) == 0); + +  exit(0); + +  /* Never reached */ +  return 0; +} + diff --git a/tests/mutex6rs.c b/tests/mutex6rs.c new file mode 100644 index 0000000..23c5555 --- /dev/null +++ b/tests/mutex6rs.c @@ -0,0 +1,92 @@ +/*  + * mutex6rs.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library 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 + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Tests PTHREAD_MUTEX_RECURSIVE static mutex type. + * Thread locks mutex twice (recursive lock). + * Both locks and unlocks should succeed. + * + * Depends on API functions:  + *      pthread_create() + *      pthread_join() + *      pthread_mutexattr_init() + *      pthread_mutexattr_destroy() + *      pthread_mutexattr_settype() + *      pthread_mutexattr_gettype() + *      pthread_mutex_init() + *      pthread_mutex_destroy() + *	pthread_mutex_lock() + *	pthread_mutex_unlock() + */ + +#include "test.h" + +static int lockCount = 0; + +static pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; + +void * locker(void * arg) +{ +  assert(pthread_mutex_lock(&mutex) == 0); +  lockCount++; +  assert(pthread_mutex_lock(&mutex) == 0); +  lockCount++; +  assert(pthread_mutex_unlock(&mutex) == 0); +  assert(pthread_mutex_unlock(&mutex) == 0); + +  return (void *) 555; +} +  +int +main() +{ +  pthread_t t; +  int result = 0; + +  assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER); + +  assert(pthread_create(&t, NULL, locker, NULL) == 0); + +  assert(pthread_join(t, (void **) &result) == 0); +  assert(result == 555); + +  assert(lockCount == 2); + +  assert(pthread_mutex_destroy(&mutex) == 0); + +  exit(0); + +  /* Never reached */ +  return 0; +} diff --git a/tests/mutex6s.c b/tests/mutex6s.c new file mode 100644 index 0000000..b6e74e9 --- /dev/null +++ b/tests/mutex6s.c @@ -0,0 +1,93 @@ +/*  + * mutex6s.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library 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 + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Test the default (type not set) static mutex type. + * Should be the same as PTHREAD_MUTEX_NORMAL. + * Thread locks mutex twice (recursive lock). + * Locking thread should deadlock on second attempt. + * + * Depends on API functions:  + *	pthread_mutex_lock() + *	pthread_mutex_trylock() + *	pthread_mutex_unlock() + */ + +#include "test.h" + +static int lockCount = 0; + +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +void * locker(void * arg) +{ +  assert(pthread_mutex_lock(&mutex) == 0); +  lockCount++; + +  /* Should wait here (deadlocked) */ +  assert(pthread_mutex_lock(&mutex) == 0); +  lockCount++; +  assert(pthread_mutex_unlock(&mutex) == 0); + +  return 0; +} +  +int +main() +{ +  pthread_t t; + +  assert(mutex == PTHREAD_MUTEX_INITIALIZER); + +  assert(pthread_create(&t, NULL, locker, NULL) == 0); + +  Sleep(1000); + +  assert(lockCount == 1); + +  /* +   * Should succeed even though we don't own the lock +   * because FAST mutexes don't check ownership. +   */ +  assert(pthread_mutex_unlock(&mutex) == 0); + +  Sleep (1000); + +  assert(lockCount == 2); + +  exit(0); + +  /* Never reached */ +  return 0; +} | 
