aboutsummaryrefslogtreecommitdiff
path: root/pthreads/tests
diff options
context:
space:
mode:
Diffstat (limited to 'pthreads/tests')
-rw-r--r--pthreads/tests/Bmakefile26
-rw-r--r--pthreads/tests/ChangeLog201
-rw-r--r--pthreads/tests/GNUmakefile448
-rw-r--r--pthreads/tests/Makefile488
-rw-r--r--pthreads/tests/SIZES.GC21
-rw-r--r--pthreads/tests/SIZES.GCE21
-rw-r--r--pthreads/tests/SIZES.VC21
-rw-r--r--pthreads/tests/SIZES.VCE21
-rw-r--r--pthreads/tests/SIZES.VSE21
-rw-r--r--pthreads/tests/Wmakefile28
-rwxr-xr-xpthreads/tests/affinity1.c111
-rwxr-xr-xpthreads/tests/affinity2.c102
-rwxr-xr-xpthreads/tests/affinity3.c100
-rwxr-xr-xpthreads/tests/affinity4.c70
-rwxr-xr-xpthreads/tests/affinity5.c103
-rw-r--r--pthreads/tests/barrier1.c9
-rw-r--r--pthreads/tests/barrier2.c9
-rw-r--r--pthreads/tests/barrier3.c9
-rw-r--r--pthreads/tests/barrier4.c9
-rw-r--r--pthreads/tests/barrier5.c9
-rw-r--r--pthreads/tests/barrier6.c235
-rw-r--r--pthreads/tests/benchlib.c9
-rw-r--r--pthreads/tests/benchtest.h9
-rw-r--r--pthreads/tests/benchtest1.c10
-rw-r--r--pthreads/tests/benchtest2.c10
-rw-r--r--pthreads/tests/benchtest3.c10
-rw-r--r--pthreads/tests/benchtest4.c10
-rw-r--r--pthreads/tests/benchtest5.c10
-rw-r--r--pthreads/tests/cancel1.c35
-rw-r--r--pthreads/tests/cancel2.c59
-rw-r--r--pthreads/tests/cancel3.c19
-rw-r--r--pthreads/tests/cancel4.c21
-rw-r--r--pthreads/tests/cancel5.c17
-rw-r--r--pthreads/tests/cancel6a.c10
-rw-r--r--pthreads/tests/cancel6d.c10
-rw-r--r--pthreads/tests/cancel7.c11
-rw-r--r--pthreads/tests/cancel8.c11
-rw-r--r--pthreads/tests/cancel9.c15
-rw-r--r--pthreads/tests/cleanup0.c17
-rw-r--r--pthreads/tests/cleanup1.c45
-rw-r--r--pthreads/tests/cleanup2.c15
-rw-r--r--pthreads/tests/cleanup3.c15
-rwxr-xr-xpthreads/tests/common.mk53
-rw-r--r--pthreads/tests/condvar1.c9
-rw-r--r--pthreads/tests/condvar1_1.c9
-rw-r--r--pthreads/tests/condvar1_2.c9
-rw-r--r--pthreads/tests/condvar2.c17
-rw-r--r--pthreads/tests/condvar2_1.c9
-rw-r--r--pthreads/tests/condvar3.c9
-rw-r--r--pthreads/tests/condvar3_1.c9
-rw-r--r--pthreads/tests/condvar3_2.c9
-rw-r--r--pthreads/tests/condvar3_3.c9
-rw-r--r--pthreads/tests/condvar4.c9
-rw-r--r--pthreads/tests/condvar5.c9
-rw-r--r--pthreads/tests/condvar6.c11
-rw-r--r--pthreads/tests/condvar7.c13
-rw-r--r--pthreads/tests/condvar8.c11
-rw-r--r--pthreads/tests/condvar9.c15
-rw-r--r--pthreads/tests/context1.c284
-rwxr-xr-xpthreads/tests/context2.c157
-rw-r--r--pthreads/tests/count1.c9
-rw-r--r--pthreads/tests/create1.c9
-rw-r--r--pthreads/tests/create2.c9
-rwxr-xr-xpthreads/tests/create3.c110
-rw-r--r--pthreads/tests/delay1.c9
-rw-r--r--pthreads/tests/delay2.c9
-rw-r--r--pthreads/tests/detach1.c9
-rw-r--r--pthreads/tests/equal1.c9
-rw-r--r--pthreads/tests/errno1.c11
-rw-r--r--pthreads/tests/exception1.c15
-rw-r--r--pthreads/tests/exception2.c24
-rw-r--r--pthreads/tests/exception3.c41
-rwxr-xr-xpthreads/tests/exception3_0.c187
-rw-r--r--pthreads/tests/exit1.c12
-rw-r--r--pthreads/tests/exit2.c9
-rw-r--r--pthreads/tests/exit3.c9
-rw-r--r--pthreads/tests/exit4.c11
-rw-r--r--pthreads/tests/exit5.c11
-rw-r--r--pthreads/tests/eyal1.c16
-rw-r--r--pthreads/tests/inherit1.c9
-rw-r--r--pthreads/tests/join0.c9
-rw-r--r--pthreads/tests/join1.c9
-rw-r--r--pthreads/tests/join2.c9
-rw-r--r--pthreads/tests/join3.c9
-rwxr-xr-xpthreads/tests/join4.c87
-rw-r--r--pthreads/tests/kill1.c9
-rw-r--r--pthreads/tests/mutex1.c9
-rw-r--r--pthreads/tests/mutex1e.c9
-rw-r--r--pthreads/tests/mutex1n.c9
-rw-r--r--pthreads/tests/mutex1r.c9
-rw-r--r--pthreads/tests/mutex2.c9
-rw-r--r--pthreads/tests/mutex2e.c9
-rw-r--r--pthreads/tests/mutex2r.c9
-rw-r--r--pthreads/tests/mutex3.c9
-rw-r--r--pthreads/tests/mutex3e.c9
-rw-r--r--pthreads/tests/mutex3r.c9
-rw-r--r--pthreads/tests/mutex4.c9
-rw-r--r--pthreads/tests/mutex5.c9
-rw-r--r--pthreads/tests/mutex6.c12
-rw-r--r--pthreads/tests/mutex6e.c12
-rw-r--r--pthreads/tests/mutex6es.c12
-rw-r--r--pthreads/tests/mutex6n.c16
-rw-r--r--pthreads/tests/mutex6r.c12
-rw-r--r--pthreads/tests/mutex6rs.c12
-rw-r--r--pthreads/tests/mutex6s.c12
-rw-r--r--pthreads/tests/mutex7.c12
-rw-r--r--pthreads/tests/mutex7e.c12
-rw-r--r--pthreads/tests/mutex7n.c12
-rw-r--r--pthreads/tests/mutex7r.c12
-rw-r--r--pthreads/tests/mutex8.c1
-rw-r--r--pthreads/tests/mutex8e.c1
-rw-r--r--pthreads/tests/mutex8n.c1
-rw-r--r--pthreads/tests/mutex8r.c1
-rw-r--r--pthreads/tests/once1.c9
-rw-r--r--pthreads/tests/once2.c22
-rw-r--r--pthreads/tests/once3.c40
-rw-r--r--pthreads/tests/once4.c32
-rw-r--r--pthreads/tests/openmp1.c8
-rw-r--r--pthreads/tests/priority1.c9
-rw-r--r--pthreads/tests/priority2.c9
-rw-r--r--pthreads/tests/reuse1.c9
-rw-r--r--pthreads/tests/reuse2.c9
-rw-r--r--pthreads/tests/robust1.c9
-rw-r--r--pthreads/tests/robust2.c9
-rw-r--r--pthreads/tests/robust3.c9
-rw-r--r--pthreads/tests/robust4.c9
-rw-r--r--pthreads/tests/robust5.c9
-rwxr-xr-xpthreads/tests/runorder.mk149
-rw-r--r--pthreads/tests/rwlock1.c9
-rw-r--r--pthreads/tests/rwlock2.c9
-rw-r--r--pthreads/tests/rwlock2_t.c9
-rw-r--r--pthreads/tests/rwlock3.c9
-rw-r--r--pthreads/tests/rwlock3_t.c9
-rw-r--r--pthreads/tests/rwlock4.c9
-rw-r--r--pthreads/tests/rwlock4_t.c9
-rw-r--r--pthreads/tests/rwlock5.c9
-rw-r--r--pthreads/tests/rwlock5_t.c9
-rw-r--r--pthreads/tests/rwlock6.c9
-rw-r--r--pthreads/tests/rwlock6_t.c9
-rw-r--r--pthreads/tests/rwlock6_t2.c9
-rw-r--r--pthreads/tests/self1.c139
-rw-r--r--pthreads/tests/self2.c9
-rw-r--r--pthreads/tests/semaphore1.c23
-rw-r--r--pthreads/tests/semaphore2.c9
-rw-r--r--pthreads/tests/semaphore3.c61
-rw-r--r--pthreads/tests/semaphore4.c9
-rw-r--r--pthreads/tests/semaphore4t.c9
-rw-r--r--pthreads/tests/semaphore5.c207
-rw-r--r--pthreads/tests/sequence1.c9
-rw-r--r--pthreads/tests/spin1.c9
-rw-r--r--pthreads/tests/spin2.c9
-rw-r--r--pthreads/tests/spin3.c9
-rw-r--r--pthreads/tests/spin4.c9
-rw-r--r--pthreads/tests/stress1.c9
-rw-r--r--pthreads/tests/test.h20
-rw-r--r--pthreads/tests/tryentercs.c9
-rw-r--r--pthreads/tests/tryentercs2.c9
-rw-r--r--pthreads/tests/tsd1.c9
-rw-r--r--pthreads/tests/tsd2.c9
-rw-r--r--pthreads/tests/valid1.c9
-rw-r--r--pthreads/tests/valid2.c9
161 files changed, 3057 insertions, 1975 deletions
diff --git a/pthreads/tests/Bmakefile b/pthreads/tests/Bmakefile
index df2ac1b1b..f4bdd9cc5 100644
--- a/pthreads/tests/Bmakefile
+++ b/pthreads/tests/Bmakefile
@@ -5,7 +5,7 @@
#
# Pthreads-win32 - POSIX Threads Library for Win32
# Copyright(C) 1998 John E. Bossom
-# Copyright(C) 1999,2005 Pthreads-win32 contributors
+# Copyright(C) 1999,2012 Pthreads-win32 contributors
#
# Contact Email: rpj@callisto.canberra.edu.au
#
@@ -64,7 +64,7 @@ BCXFLAGS = -D__CLEANUP_C
CPLIB = $(BCLIB)
CPDLL = $(BCDLL)
-CFLAGS= -q $(OPTIM) /D_WIN32_WINNT=0x400 -w -tWC -tWM -4 -w-aus -w-asc -w-par
+CFLAGS= -q $(OPTIM) -w -tWC -tWM -4 -w-aus -w-asc -w-par
LFLAGS=
INCLUDES=-I.
BUILD_DIR=..
@@ -76,7 +76,7 @@ EHFLAGS =
# If a test case returns a non-zero exit code to the shell, make will
# stop.
-PASSES= loadfree.pass \
+PASSES= \
errno1.pass \
self1.pass mutex5.pass \
mutex1.pass mutex1n.pass mutex1e.pass mutex1r.pass \
@@ -87,7 +87,7 @@ PASSES= loadfree.pass \
exit1.pass create1.pass create2.pass reuse1.pass reuse2.pass equal1.pass \
sequence1.pass kill1.pass valid1.pass valid2.pass \
exit2.pass exit3.pass exit4.pass exit5.pass \
- join0.pass join1.pass detach1.pass join2.pass join3.pass \
+ join0.pass join1.pass detach1.pass join2.pass join3.pass join4.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 \
@@ -112,8 +112,10 @@ PASSES= loadfree.pass \
cleanup0.pass cleanup1.pass cleanup2.pass cleanup3.pass \
priority1.pass priority2.pass inherit1.pass \
spin1.pass spin2.pass spin3.pass spin4.pass \
- exception1.pass exception2.pass exception3.pass \
- cancel9.pass stress1.pass
+ exception1.pass exception2.pass exception3_0.pass exception3.pass \
+ cancel9.pass \
+ affinity1.pass affinity2.pass affinity3.pass affinity4.pass affinity5.pass \
+ stress1.pass
BENCHRESULTS = \
benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench
@@ -214,6 +216,7 @@ clean:
- $(RM) *.o
- $(RM) *.asm
- $(RM) *.exe
+ - $(RM) *.manifest
- $(RM) *.pass
- $(RM) *.bench
- $(RM) *.log
@@ -223,6 +226,12 @@ benchtest2.bench:
benchtest3.bench:
benchtest4.bench:
benchtest5.bench:
+
+affinity1.pass:
+affinity2.pass: affinity1.pass
+affinity3.pass: affinity2.pass
+affinity4.pass: affinity3.pass
+affinity5.pass: affinity4.pass
barrier1.pass: semaphore4.pass
barrier2.pass: barrier1.pass
barrier3.pass: barrier2.pass
@@ -269,7 +278,8 @@ equal1.pass: create1.pass
errno1.pass: mutex3.pass
exception1.pass: cancel4.pass
exception2.pass: exception1.pass
-exception3.pass: exception2.pass
+exception3_0.pass: exception2.pass
+exception3.pass: exception3_0.pass
exit1.pass:
exit2.pass: create1.pass
exit3.pass: create1.pass
@@ -281,8 +291,8 @@ join0.pass: create1.pass
join1.pass: create1.pass
join2.pass: create1.pass
join3.pass: join2.pass
+join4.pass: join3.pass
kill1.pass:
-loadfree.pass: pthread.dll
mutex1.pass: self1.pass
mutex1n.pass: mutex1.pass
mutex1e.pass: mutex1.pass
diff --git a/pthreads/tests/ChangeLog b/pthreads/tests/ChangeLog
index dfb4f4555..5cb92fefa 100644
--- a/pthreads/tests/ChangeLog
+++ b/pthreads/tests/ChangeLog
@@ -1,3 +1,192 @@
+2012-10-16 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * GNUmakefile (EXTRAVERSION): Naming option for libraries to be
+ consistent with MSVS Makefile; no longer automatically based on
+ ARCH setting.
+
+2012-10-10 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * cancel1.c: Fix comment typo.
+ * Makefile: Adding functionality to support rapid turnaround of
+ individual or small sets of tests; removed loadfree test.
+ * GNUmakefile: Likewise.
+ * Bmakefile: Removed loadfree test.
+ * Wmakefile: Likewise.
+ * common.mk: New makefile include file; split out common macros.
+ * runorder.mk: New makefile include file; split out run order rules
+ to allow selective inclusion.
+ * loadfree.c: Removed from suite; not required; unnecessarily
+ complicates the makefiles.
+
+2012-10-04 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * join4.c: Modified for pthread_tryjoin_np tests.
+
+2012-09-29 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * Makefile: Align target names with build makefile target names
+ following changes there; remove the separate static tests list.
+ * GNUmakefile: Likewise; consolidate rules.
+
+2012-09-25 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * context1.c (anotherEnding): Should exit the thread, not return.
+
+2012-09-23 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * Makefile: Add secondary target names to existing test targets so
+ we can output how the library was built, e.g. "Running VC-inlined test".
+ This is useful when making "all-tests" from the library build Makefile.
+ * GNUmakefile: Similarly.
+
+2012-09-22 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * GNUmakefile: Do what Makefile does and print the make target
+ when running each test.
+
+2012-09-22 Daniel Richard. G <danielg at teragram dot com>
+
+ * Makefile: This reverts an earlier change of mine. In some
+ versions of nmake, $(MAKE) is a full path, which utterly futzes
+ up the "make help" output; regularized the test targets, so we
+ have e.g. VSE-static now; regularized the parentheticals;
+ removed a spurious use of $(DLL_VER); new test targets: VCX-debug
+ {VSE,VCX}-static{,-debug}; fixed the {VC,VCE}-static-debug targets.
+ * exception3.c: Narrowly exclude this test from the known-bad VS2005
+ configuration (By the way: I downloaded and tested with what is
+ presumably the most up-to-date MSVCR80.DLL. Same deal.); use
+ pthread_win32_set_terminate_np() when appropriate, and verify that
+ it has an effect different from calling set_terminate(); no need for
+ that assert(); it's overly pedantic.
+ * exception3_0.c: Same VS2005 exclusion.
+ * once3.c: Put in a note so that users know what to do if the test
+ hangs or exits abnormally (I figured this is better than narrowly
+ disabling pthread_cancel() on MSVC6, since cancellation does seem to
+ work correctly with /EHa, and we don't have any way of telling at
+ compile time whether /EHs or /EHa is in use).
+ * once4.c: Likewise.
+ * semaphore1.c: s/PTW32_BROKEN_ERRNO/PTW32_USES_SEPARATE_CRT/
+
+2012-09-22 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * pthread_win32_attach_detach_np.c (pthread_win32_detach_thread_np):
+ Check for NULL ptw32_selfThreadKey before call to TlsSetKey(). Need
+ to find where this is being set to NULL before this point. Was
+ consistently failing tests/seamphore3.c in all GC static builds and
+ never seen in GC DLL builds. May also be responsible for
+ inconsistent VCE fails on that test, although the fail mode was
+ different - the latter hangs the test while the former segfaults.
+
+2012-09-22 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * GNUmakefile (GC-static-debug): New make target.
+
+2012-09-21 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * affinity1.c: New test for new process CPU affinity routines.
+ * affinity2.c: New test for new process CPU affinity routines.
+ * affinity3.c: New test for new process and thread CPU affinity routines.
+ * affinity4.c: New test for new process and thread CPU affinity routines.
+ * affinity5.c: New test for new process and thread CPU affinity routines.
+ * Makefile: Add new tests.
+ * GNUmakfile: Likewise.
+ * Bmakfile: Likewise.
+ * Wmakfile: Likewise.
+
+2012-09-09 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * exception3.c: Rewrite to fix strategy.
+ * exception3_0.c: New test.
+ * exception2.c: Reduce sleep time to speed up test.
+ * Makefile (exception3_0.*): Add new test.
+ * GNUmakefile (exception3_0.*): Add new test.
+ * Bmakefile (exception3_0.*): Add new test.
+ * Wmakefile (exception3_0.*): Add new test.
+
+2012-09-05 Daniel Richard. G <danielg at teragram dot com>
+
+ * exception2.c: Fix result codes to avoid false negative failures.
+ * cancel9.c: cosmetic change.
+ * GNUmakefile (clean): delete manifest files.
+ * Bmakefile: Likewise.
+ * Wmakefile: Likewise.
+ * Makefile: Likewise.
+
+2012-09-04 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * Makefile (VCEFLAGS): Changed from /EHsc to /EHs which was causing
+ tests/once3.c to hang, suspect exceptions not being thrown from
+ extern C routines.
+ * cancel2.c: Rewrite to use a barrier for thread control; remove
+ asyncronous cancel type which was a massive bug in the test strategy
+ and cusing SEGFAULTs (access violations).
+ * eyal1.c: Remove unused variable 'i' to clear compiler warning.
+ * context1.c: Remove call to pthread_exit() in alternate ending to
+ quell error in GCE tests see when running x86 build on x64.
+
+2012-09-03 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * Makefile (VCE-static): Add VC++ static build target
+ (VCE-static-debug): Likewise.
+
+2012-08-29 Daniel Richard. G <danielg at teragram dot com>
+
+ * mutex6.c: Removed pointless exit(0) and never-reached comment.
+ * mutex6r.c: Likewise.
+ * mutex6rs.c: Likewise.
+ * mutex6s.c: Likewise.
+ * mutex6e.c: Likewise.
+ * mutex6es.c: Likewise.
+ * mutex7.c: Likewise.
+ * mutex7e.c: Likewise.
+ * mutex7n.c: Likewise.
+ * mutex7r.c: Likewise.
+ * mutex6n.c: Likewise; ensure operator precedence.
+ * once2.c (sharedInt_t): replace static initialization of struct with memset.
+ * once3.c: Likewise.
+ * once4.c: Likewise.
+ * cleanup0.c: Likewise.
+ * cleanup1.c: Likewise.
+ * cleanup2.c: Likewise.
+ * cleanup3.c: Likewise.
+ * openmp1.c: Fix casts.
+ * exit1.c: Remove assert statement that is never reached and return 1.
+ * exception2.c: Prevent displaying modal error dialog.
+
+2012-08-19 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * join4.c: Test for new pthread_timedjoin_np routine
+ * Makefile (join4): Added.
+ * GNUmakefile (join4): Added.
+ * Bmakefile (join4): Added.
+ * Wmakefile (join4): Added.
+ * test.h (sys/timeb.h): Add #include.
+ * mutex8.c (sys/timeb.h): Remove #include.
+ * mutex8e.c (sys/timeb.h): Remove #include.
+ * mutex8n.c (sys/timeb.h): Remove #include.
+ * mutex8r.c (sys/timeb.h): Remove #include.
+ * benchtest1.c (sys/timeb.h): Remove #include.
+ * benchtest2.c (sys/timeb.h): Remove #include.
+ * benchtest3.c (sys/timeb.h): Remove #include.
+ * benchtest4.c (sys/timeb.h): Remove #include.
+ * benchtest5.c (sys/timeb.h): Remove #include.
+
+2012-08-11 Daniel Richard. G <danielg at teragram dot com>
+
+ * Makefile: Various improvements.
+ * GNUmakefile: Likewise.
+
+2011-07-20 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * cancel2.c (PTHREAD_CANCELED): Fix cast warning when compiling with g++.
+ * cleanup0.c (PTHREAD_CANCELED): Likewise.
+ * cleanup1.c (PTHREAD_CANCELED): Likewise.
+
+2012-07-19 Daniel Richard. G <danielg at teragram dot com>
+
+ * Makefile: Various fixes.
+ * GNUmakefile: Likewise.
+
2011-07-03 Ross Johnson <ross dot johnson at homemail dot com dot au>
* create3.c: Removed; testing a condition that is not in the library's
@@ -96,7 +285,7 @@
* GNUMakefile: Update for new tests.
* Makefile: Ditto.
* BMakefile: Ditto.
- * once3.c: Improve cancelation testing.
+ * once3.c: Improve cancellation testing.
* stress1.c: Fix comment.
2007-01-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
@@ -742,13 +931,13 @@
2000-01-04 Ross Johnson <rpj@special.ise.canberra.edu.au>
- * cancel4.c: New; Test cancelation does not occur in deferred
- cancelation threads with no cancelation points.
+ * cancel4.c: New; Test cancellation does not occur in deferred
+ cancellation threads with no cancellation points.
- * cancel3.c: New; Test asynchronous cancelation.
+ * cancel3.c: New; Test asynchronous cancellation.
* context1.c: New; Test context switching method for async
- cancelation.
+ cancellation.
1999-11-23 Ross Johnson <rpj@special.ise.canberra.edu.au>
@@ -772,7 +961,7 @@ Oct 14 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* condvar7.c: New. Test broadcast after waiting thread is canceled.
* condvar8.c: New. Test multiple broadcasts.
* condvar9.c: New. Test multiple broadcasts with thread
- cancelation.
+ cancellation.
Sep 16 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
diff --git a/pthreads/tests/GNUmakefile b/pthreads/tests/GNUmakefile
index 355c27e8c..7cbdf7446 100644
--- a/pthreads/tests/GNUmakefile
+++ b/pthreads/tests/GNUmakefile
@@ -5,9 +5,7 @@
#
# Pthreads-win32 - POSIX Threads Library for Win32
# Copyright(C) 1998 John E. Bossom
-# Copyright(C) 1999,2005 Pthreads-win32 contributors
-#
-# Contact Email: rpj@callisto.canberra.edu.au
+# Copyright(C) 1999,2012 Pthreads-win32 contributors
#
# The current list of contributors is contained
# in the file CONTRIBUTORS included with the source
@@ -31,21 +29,27 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
-DLL_VER = 2
+DLL_VER = 2$(EXTRAVERSION)
-CP = cp -f
-MV = mv -f
-RM = rm -f
-CAT = cat
-MKDIR = mkdir
-TOUCH = echo Passed >
-ECHO = @echo
-MAKE = make -k
+CP = cp -f
+MV = mv -f
+RM = rm -f
+CAT = cat
+MKDIR = mkdir
+ECHO = echo
+TOUCH = $(ECHO) Passed >
+TESTFILE = test -f
+TESTDIR = test -d
+AND = &&
# For cross compiling use e.g.
# # make CROSS=i386-mingw32msvc- clean GC
CROSS =
+# For cross testing use e.g.
+# # make RUN=wine CROSS=i386-mingw32msvc- clean GC
+RUN =
+
AR = $(CROSS)ar
DLLTOOL = $(CROSS)dlltool
CC = $(CROSS)gcc
@@ -53,25 +57,35 @@ CXX = $(CROSS)g++
RANLIB = $(CROSS)ranlib
#
-# Mingw32
+# Mingw
#
+XLIBS =
XXCFLAGS =
-XXLIBS = -lws2_32 -lgomp
+XXLIBS =
OPT = -O3
DOPT = -g -O0
-#CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
-CFLAGS = ${OPT} -UNDEBUG -Wall $(XXCFLAGS)
+CFLAGS = ${OPT} $(ARCH) -UNDEBUG -Wall $(XXCFLAGS)
+LFLAGS = $(ARCH) $(XXLFLAGS)
+#
+# Uncomment this next to link the GCC/C++ runtime libraries statically
+# (Be sure to read about these options and their associated caveats
+# at http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html)
+#
+# NOTE 1: Doing this appears to break GCE:pthread_cleanup_*(), which
+# relies on C++ class destructors being called when leaving scope.
+#
+# NOTE 2: If you do this DO NOT distribute your pthreads DLLs with
+# the official filenaming, i.e. pthreadVC2.dll, etc. Instead, change DLL_VER
+# above to "2slgcc" for example, to build "pthreadGC2slgcc.dll", etc.
+#
+#LFLAGS += -static-libgcc -static-libstdc++
BUILD_DIR = ..
INCLUDES = -I.
-.INTERMEDIATE: %.exe %.pass
-.SECONDARY: %.exe %.pass
-.PRECIOUS: %.exe %.pass
-
TEST = GC
# Default lib version
-GCX = $(TEST)$(DLL_VER)
+GCX = GC$(DLL_VER)
# Files we need to run the tests
# - paths are relative to pthreads build dir.
@@ -81,345 +95,134 @@ DLL = pthread$(GCX).dll
# The next path is relative to $BUILD_DIR
QAPC = # ../QueueUserAPCEx/User/quserex.dll
-COPYFILES = $(HDR) $(LIB) $(DLL) $(QAPC)
-
-# If a test case returns a non-zero exit code to the shell, make will
-# stop.
-
-TESTS = \
- sizes loadfree \
- self1 mutex5 mutex1 mutex1e mutex1n mutex1r \
- semaphore1 semaphore2 semaphore3 \
- condvar1 condvar1_1 condvar1_2 condvar2 condvar2_1 exit1 \
- create1 create2 reuse1 reuse2 equal1 \
- sequence1 kill1 valid1 valid2 \
- exit2 exit3 exit4 exit5 \
- join0 join1 detach1 join2 join3 \
- mutex2 mutex2r mutex2e mutex3 mutex3r mutex3e \
- mutex4 mutex6 mutex6n mutex6e mutex6r \
- mutex6s mutex6es mutex6rs \
- mutex7 mutex7n mutex7e mutex7r mutex8 mutex8n mutex8e mutex8r \
- robust1 robust2 robust3 robust4 robust5 \
- count1 \
- once1 once2 once3 once4 self2 \
- cancel1 cancel2 \
- semaphore4 semaphore4t semaphore5 \
- barrier1 barrier2 barrier3 barrier4 barrier5 barrier6 \
- tsd1 tsd2 openmp1 delay1 delay2 eyal1 \
- condvar3 condvar3_1 condvar3_2 condvar3_3 \
- condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \
- errno1 \
- rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 rwlock7 rwlock8 \
- rwlock2_t rwlock3_t rwlock4_t rwlock5_t rwlock6_t rwlock6_t2 \
- context1 cancel3 cancel4 cancel5 cancel6a cancel6d \
- cancel7 cancel8 \
- cleanup0 cleanup1 cleanup2 cleanup3 \
- priority1 priority2 inherit1 \
- spin1 spin2 spin3 spin4 \
- exception1 exception2 exception3 \
- cancel9 stress1
-
-STRESSTESTS = \
- stress1
-
-BENCHTESTS = \
- benchtest1 benchtest2 benchtest3 benchtest4 benchtest5
-
-STATICTESTS = \
- sizes \
- self1 mutex5 mutex1 mutex1e mutex1n mutex1r \
- semaphore1 semaphore2 semaphore3 \
- condvar1 condvar1_1 condvar1_2 condvar2 condvar2_1 exit1 \
- create1 create2 reuse1 reuse2 equal1 \
- sequence1 kill1 valid1 valid2 \
- exit2 exit3 exit4 exit5 \
- join0 join1 detach1 join2 join3 \
- mutex2 mutex2r mutex2e mutex3 mutex3r mutex3e \
- mutex4 mutex6 mutex6n mutex6e mutex6r \
- mutex6s mutex6es mutex6rs \
- mutex7 mutex7n mutex7e mutex7r mutex8 mutex8n mutex8e mutex8r \
- robust1 robust2 robust3 robust4 robust5 \
- count1 \
- once1 once2 once3 once4 self2 \
- cancel1 cancel2 \
- semaphore4 semaphore4t semaphore5 \
- barrier1 barrier2 barrier3 barrier4 barrier5 barrier6 \
- tsd1 tsd2 delay1 delay2 eyal1 \
- condvar3 condvar3_1 condvar3_2 condvar3_3 \
- condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \
- errno1 \
- rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 rwlock7 rwlock8 \
- rwlock2_t rwlock3_t rwlock4_t rwlock5_t rwlock6_t rwlock6_t2 \
- context1 cancel3 cancel4 cancel5 cancel6a cancel6d \
- cancel7 cancel8 \
- cleanup0 cleanup1 cleanup2 cleanup3 \
- priority1 priority2 inherit1 \
- spin1 spin2 spin3 spin4 \
- exception1 exception2 exception3 \
- cancel9 stress1
-
-ALLTESTS = $(TESTS) $(BENCHTESTS)
-
-ASM = $(ALLTESTS:%=%.s)
-PASSES = $(TESTS:%=%.pass)
+include common.mk
+
+.INTERMEDIATE: $(ALL_KNOWN_TESTS:%=%.exe) $(BENCHTESTS:%=%.exe)
+.SECONDARY: $(ALL_KNOWN_TESTS:%=%.exe) $(ALL_KNOWN_TESTS:%=%.pass) $(BENCHTESTS:%=%.exe) $(BENCHTESTS:%=%.bench)
+.PRECIOUS: $(ALL_KNOWN_TESTS:%=%.exe) $(ALL_KNOWN_TESTS:%=%.pass) $(BENCHTESTS:%=%.exe) $(BENCHTESTS:%=%.bench)
+
+ASM = $(ALL_KNOWN_TESTS:%=%.s)
+TESTS = $(ALL_KNOWN_TESTS)
BENCHRESULTS = $(BENCHTESTS:%=%.bench)
-STRESSRESULTS = $(STRESSTESTS:%=%.pass)
-STATICRESULTS = $(STATICTESTS:%=%.pass)
+
+#
+# To build and run "foo.exe" and "bar.exe" only use, e.g.:
+# make clean GC NO_DEPS=1 TESTS="foo bar"
+#
+# To build and run "foo.exe" and "bar.exe" and run all prerequisite tests
+# use, e.g.:
+# make clean GC TESTS="foo bar"
+#
+# Set TESTS to one or more tests.
+#
+ifndef NO_DEPS
+include runorder.mk
+endif
help:
@ $(ECHO) "Run one of the following command lines:"
- @ $(ECHO) "make clean GC (to test using GC dll with C (no EH) applications)"
- @ $(ECHO) "make clean GCX (to test using GC dll with C++ (EH) applications)"
- @ $(ECHO) "make clean GCE (to test using GCE dll with C++ (EH) applications)"
- @ $(ECHO) "make clean GC-bench (to benchtest using GNU C dll with C cleanup code)"
- @ $(ECHO) "make clean GCE-bench (to benchtest using GNU C dll with C++ exception handling)"
- @ $(ECHO) "make clean GC-stress (to stresstest using GNU C dll with C cleanup code)"
- @ $(ECHO) "make clean GCE-stress (to stresstest using GNU C dll with C++ exception handling)"
- @ $(ECHO) "make clean GC-static (to test using GC static lib with C (no EH) applications)"
- @ $(ECHO) "make clean GC-debug (to test using GC dll with C (no EH) applications)"
-
-all:
- @ $(MAKE) clean GC
- @ $(MAKE) clean GCX
- @ $(MAKE) clean GCE
+ @ $(ECHO) "$(MAKE) clean GC (to test using GC dll with C (no EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GCX (to test using GC dll with C++ (EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GCE (to test using GCE dll with C++ (EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GC-bench (to benchtest using GNU C dll with C cleanup code)"
+ @ $(ECHO) "$(MAKE) clean GC-debug (to test using GC dll with C (no EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GC-static (to test using GC static lib with C (no EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GC-static-debug (to test using GC static lib with C (no EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GCE-static (to test using GC static lib with C (no EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GCE-static-debug (to test using GC static lib with C (no EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GCE-debug (to test using GCE dll with C++ (EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GCX-static (to test using GC static lib with C++ applications)"
+ @ $(ECHO) "$(MAKE) clean GCX-static-debug (to test using GC static lib with C++ applications)"
+ @ $(ECHO) "$(MAKE) clean GCX-debug (to test using GCE dll with C++ (EH) applications)"
+ @ $(ECHO) "$(MAKE) clean GC-foo (to build individual test \"foo.c\" with C and run using GC dll)"
+ @ $(ECHO) "$(MAKE) clean GCE-foo (to build individual tests \"foo.c\" with C++ and run using GCE dll)"
+ @ $(ECHO) "$(MAKE) clean GCX-foo (to build individual tests \"foo.c\" with C++ and run using GC dll)"
GC:
- $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-pass
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" allpassed
GC-asm:
- $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-asm
-
-GCE:
- $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_CXX" all-pass
-
-GCX:
- $(MAKE) TEST=GC CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_C" all-pass
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" all-asm
GC-bench:
- $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
-GCE-bench:
- $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
+GC-bench-debug:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" OPT="${DOPT}" all-bench
GC-debug:
- $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CC) XXCFLAGS="-D__CLEANUP_C" OPT="${DOPT}" allpassed
+
+GC-static GC-small-static:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" DLL="" allpassed
+
+GC-static-debug GC-small-static-debug:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" OPT="$(DOPT)" DLL="" allpassed
+
+GCE:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)" CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" allpassed
GCE-debug:
- $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -D__CLEANUP_CXX" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_CXX" OPT="${DOPT}" allpassed
-GC-bench-debug:
- $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" OPT="${OPT}" DLL_VER="$(DLL_VER)d" all-bench
+GCE-static GCE-small-static:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)" CC=$(CXX) XXCFLAGS="-D__CLEANUP_CXX -DPTW32_STATIC_LIB" DLL="" allpassed
-GC-static:
- $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" XXLIBS="-lws2_32" DLL="" all-static
+GCE-static-debug GCE-small-static-debug:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GCE$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_CXX -DPTW32_STATIC_LIB" OPT="$(DOPT)" DLL="" allpassed
+
+GCX:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_C" allpassed
-GC-stress:
- $(ECHO) Stress tests can take a long time since they are trying to
- $(ECHO) expose weaknesses that may be intermittant or statistically rare.
- $(ECHO) A pass does not prove correctness, but may give greater confidence.
- $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="" all-stress
+GCX-debug:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_C" OPT="${DOPT}" allpassed
-GCE-stress:
- $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="" all-stress
+GCX-static GCX-small-static:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)" CC=$(CXX) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" DLL="" allpassed
+
+GCX-static-debug GCX-small-static-debug:
+ @ $(MAKE) --no-builtin-rules TEST=$@ GCX="GC$(DLL_VER)d" CC=$(CXX) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" OPT="$(DOPT)" DLL="" allpassed
all-asm: $(ASM)
- @ $(ECHO) ALL TESTS PASSED! Congratulations!
-
-all-pass: $(PASSES)
- @ $(ECHO) ALL TESTS PASSED! Congratulations!
-
-all-bench: $(BENCHRESULTS)
- @ $(ECHO) BENCH TESTS COMPLETED.
-
-all-stress: $(STRESSRESULTS)
- @ $(ECHO) STRESS TESTS COMPLETED.
-
-all-static: $(STATICRESULTS)
- @ $(ECHO) ALL STATIC TESTS PASSED! Congratulations!
-
-benchtest1.bench:
-benchtest2.bench:
-benchtest3.bench:
-benchtest4.bench:
-benchtest5.bench:
-
-barrier1.pass: semaphore4.pass
-barrier2.pass: barrier1.pass
-barrier3.pass: barrier2.pass
-barrier4.pass: barrier3.pass
-barrier5.pass: barrier4.pass
-barrier6.pass: barrier5.pass
-cancel1.pass: create1.pass
-cancel2.pass: cancel1.pass
-cancel3.pass: context1.pass
-cancel4.pass: cancel3.pass
-cancel5.pass: cancel3.pass
-cancel6a.pass: cancel3.pass
-cancel6d.pass: cancel3.pass
-cancel7.pass: kill1.pass
-cancel8.pass: cancel7.pass
-cancel9.pass: cancel8.pass
-cleanup0.pass: cancel5.pass
-cleanup1.pass: cleanup0.pass
-cleanup2.pass: cleanup1.pass
-cleanup3.pass: cleanup2.pass
-condvar1.pass:
-condvar1_1.pass: condvar1.pass
-condvar1_2.pass: join2.pass
-condvar2.pass: condvar1.pass
-condvar2_1.pass: condvar2.pass join2.pass
-condvar3.pass: create1.pass condvar2.pass
-condvar3_1.pass: condvar3.pass join2.pass
-condvar3_2.pass: condvar3_1.pass
-condvar3_3.pass: condvar3_2.pass
-condvar4.pass: create1.pass
-condvar5.pass: condvar4.pass
-condvar6.pass: condvar5.pass
-condvar7.pass: condvar6.pass cleanup1.pass
-condvar8.pass: condvar7.pass
-condvar9.pass: condvar8.pass
-context1.pass: cancel1.pass
-count1.pass: join1.pass
-create1.pass: mutex2.pass
-create2.pass: create1.pass
-delay1.pass:
-delay2.pass: delay1.pass
-detach1.pass: join0.pass
-equal1.pass: create1.pass
-errno1.pass: mutex3.pass
-exception1.pass: cancel4.pass
-exception2.pass: exception1.pass
-exception3.pass: exception2.pass
-exit1.pass:
-exit2.pass: create1.pass
-exit3.pass: create1.pass
-exit4.pass:
-exit5.pass: exit4.pass kill1.pass
-eyal1.pass: tsd1.pass
-inherit1.pass: join1.pass priority1.pass
-join0.pass: create1.pass
-join1.pass: create1.pass
-join2.pass: create1.pass
-join3.pass: join2.pass
-kill1.pass:
-loadfree.pass: pthread.dll
-mutex1.pass: self1.pass
-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
-mutex7r.pass: mutex6r.pass
-mutex8.pass: mutex7.pass
-mutex8n.pass: mutex7n.pass
-mutex8e.pass: mutex7e.pass
-mutex8r.pass: mutex7r.pass
-once1.pass: create1.pass
-once2.pass: once1.pass
-once3.pass: once2.pass
-once4.pass: once3.pass
-openmp1.pass: tsd2.pass
-priority1.pass: join1.pass
-priority2.pass: priority1.pass barrier3.pass
-reuse1.pass: create2.pass
-reuse2.pass: reuse1.pass
-robust1.pass: mutex8r.pass
-robust2.pass: mutex8r.pass
-robust3.pass: robust2.pass
-robust4.pass: robust3.pass
-robust5.pass: robust4.pass
-rwlock1.pass: condvar6.pass
-rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.pass join2.pass
-rwlock4.pass: rwlock3.pass
-rwlock5.pass: rwlock4.pass
-rwlock6.pass: rwlock5.pass
-rwlock7.pass: rwlock6.pass
-rwlock8.pass: rwlock7.pass
-rwlock2_t.pass: rwlock2.pass
-rwlock3_t.pass: rwlock2_t.pass
-rwlock4_t.pass: rwlock3_t.pass
-rwlock5_t.pass: rwlock4_t.pass
-rwlock6_t.pass: rwlock5_t.pass
-rwlock6_t2.pass: rwlock6_t.pass
-self1.pass:
-self2.pass: create1.pass
-semaphore1.pass:
-semaphore2.pass:
-semaphore3.pass: semaphore2.pass
-semaphore4.pass: semaphore3.pass cancel1.pass
-semaphore4t.pass: semaphore4.pass
-semaphore5.pass: semaphore4.pass
-sequence1.pass: reuse2.pass
-sizes.pass:
-spin1.pass:
-spin2.pass: spin1.pass
-spin3.pass: spin2.pass
-spin4.pass: spin3.pass
-stress1.pass:
-tsd1.pass: barrier5.pass join1.pass
-tsd2.pass: tsd1.pass
-valid1.pass: join1.pass
-valid2.pass: valid1.pass
-
-sizes.pass: sizes.exe
- @ $(ECHO) Running $*
- ./$< > SIZES.$(TEST)
- @ $(CAT) SIZES.$(TEST)
- @ $(ECHO) Passed
- @ $(TOUCH) $@
+ @ $(ECHO) "ALL TESTS PASSED! Congratulations!"
+
+allpassed: $(HDR) $(LIB) $(DLL) $(QAPC) $(TESTS:%=%.pass)
+ @ $(ECHO) "ALL TESTS PASSED! Congratulations!"
+
+all-bench: $(HDR) $(LIB) $(DLL) $(QAPC) $(XXLIBS) $(BENCHRESULTS)
+ @ $(ECHO) "ALL BENCH TESTS COMPLETED."
+
+cancel9.exe: XLIBS = -lws2_32
%.pass: %.exe
- @ $(ECHO) Running $*
- ./$*
+ @ $(ECHO) Running $(TEST) test \"$*\"
+ @ $(RUN) ./$*
@ $(ECHO) Passed
@ $(TOUCH) $@
-%.bench: $(LIB) $(DLL) $(HDR) $(QAPC) $(XXLIBS) %.exe
- @ $(ECHO) Running $*
- ./$*
+%.bench: %.exe
+ @ $(ECHO) Running $(TEST) test \"$*\"
+ @ $(RUN) ./$*
@ $(ECHO) Done
@ $(TOUCH) $@
-%.exe: %.c $(LIB) $(DLL) $(HDR) $(QAPC)
- @ $(ECHO) Compiling $@
- @ $(ECHO) $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS)
- @ $(CC) $(CFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) -lsupc++ $(XXLIBS)
+%.exe: %.c
+ $(CC) $(CFLAGS) $(LFLAGS) -o $@ $< $(INCLUDES) -L. -lpthread$(GCX) $(XLIBS) $(XXLIBS)
%.pre: %.c $(HDR)
- @ $(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
+ $(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
%.s: %.c $(HDR)
@ $(ECHO) Compiling $@
- @ $(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
+ $(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
-$(COPYFILES):
+$(HDR) $(LIB) $(DLL) $(QAPC):
@ $(ECHO) Copying $(BUILD_DIR)/$@
- @ $(CP) $(BUILD_DIR)/$@ .
+ @ $(TESTFILE) $(BUILD_DIR)/$@ $(AND) $(CP) $(BUILD_DIR)/$@ .
benchlib.o: benchlib.c
@ $(ECHO) Compiling $@
- @ $(ECHO) $(CC) -c $(CFLAGS) $< $(INCLUDES)
- @ $(CC) -c $(CFLAGS) $< $(INCLUDES)
-
-pthread.dll: $(DLL)
- @ $(CP) $(DLL) $@
+ $(CC) -c $(CFLAGS) $< $(INCLUDES)
clean:
- $(RM) *.dll
@@ -436,7 +239,8 @@ clean:
- $(RM) *.obj
- $(RM) *.pdb
- $(RM) *.exe
+ - $(RM) *.manifest
- $(RM) *.pass
- $(RM) *.bench
- - $(RM) *.static
- $(RM) *.log
+ \ No newline at end of file
diff --git a/pthreads/tests/Makefile b/pthreads/tests/Makefile
index 9b0ca3094..15f98686f 100644
--- a/pthreads/tests/Makefile
+++ b/pthreads/tests/Makefile
@@ -5,9 +5,7 @@
#
# Pthreads-win32 - POSIX Threads Library for Win32
# Copyright(C) 1998 John E. Bossom
-# Copyright(C) 1999,2005 Pthreads-win32 contributors
-#
-# Contact Email: rpj@callisto.canberra.edu.au
+# Copyright(C) 1999,2012 Pthreads-win32 contributors
#
# The current list of contributors is contained
# in the file CONTRIBUTORS included with the source
@@ -31,14 +29,15 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
-DLL_VER = 2
+DLL_VER = 2$(EXTRAVERSION)
CP = copy
RM = erase
+RMDIR = rmdir /s /q
CAT = type
MKDIR = mkdir
-TOUCH = echo Passed >
ECHO = echo
+TOUCH = $(ECHO) touched >
# The next path is relative to $BUILD_DIR
QAPC = # ..\QueueUserAPCEx\User\quserex.dll
@@ -50,19 +49,25 @@ OPTIM = /O2 /Ob0
XXLIBS = ws2_32.lib
# C++ Exceptions
-VCEFLAGS = /EHsc /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
+VCEFLAGS = /EHs /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
VCELIB = pthreadVCE$(DLL_VER).lib
VCEDLL = pthreadVCE$(DLL_VER).dll
+VCELIBD = pthreadVCE$(DLL_VER)d.lib
+VCEDLLD = pthreadVCE$(DLL_VER)d.dll
# Structured Exceptions
VSEFLAGS = /D__CLEANUP_SEH
VSELIB = pthreadVSE$(DLL_VER).lib
VSEDLL = pthreadVSE$(DLL_VER).dll
+VSELIBD = pthreadVSE$(DLL_VER)d.lib
+VSEDLLD = pthreadVSE$(DLL_VER)d.dll
# C cleanup code
VCFLAGS = /D__CLEANUP_C
VCLIB = pthreadVC$(DLL_VER).lib
VCDLL = pthreadVC$(DLL_VER).dll
+VCLIBD = pthreadVC$(DLL_VER)d.lib
+VCDLLD = pthreadVC$(DLL_VER)d.dll
# C++ Exceptions in application - using VC version of pthreads dll
-VCXFLAGS = /EHsc /TP /D__CLEANUP_C
+VCXFLAGS = /EHs /TP /D__CLEANUP_C
# Defaults
CPLIB = $(VCLIB)
@@ -73,377 +78,168 @@ LFLAGS= /INCREMENTAL:NO
INCLUDES=-I.
BUILD_DIR=..
-COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
-
-TEST =
-EHFLAGS =
+EHFLAGS =
# If a test case returns a non-zero exit code to the shell, make will
# stop.
-PASSES = sizes.pass $(REGULAR_PASSES)
-
-REGULAR_PASSES = loadfree.pass \
- self1.pass mutex5.pass \
- mutex1.pass mutex1n.pass mutex1e.pass mutex1r.pass \
- semaphore1.pass semaphore2.pass semaphore3.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 \
- sequence1.pass kill1.pass valid1.pass valid2.pass \
- exit2.pass exit3.pass exit4.pass exit5.pass \
- join0.pass join1.pass detach1.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 \
- robust1.pass robust2.pass robust3.pass robust4.pass robust5.pass \
- count1.pass \
- once1.pass once2.pass once3.pass once4.pass \
- self2.pass \
- cancel1.pass cancel2.pass \
- semaphore4.pass semaphore4t.pass semaphore5.pass \
- barrier1.pass barrier2.pass barrier3.pass barrier4.pass barrier5.pass barrier6.pass \
- tsd1.pass tsd2.pass delay1.pass delay2.pass eyal1.pass \
- condvar3.pass condvar3_1.pass condvar3_2.pass condvar3_3.pass \
- condvar4.pass condvar5.pass condvar6.pass \
- condvar7.pass condvar8.pass condvar9.pass \
- errno1.pass \
- rwlock1.pass rwlock2.pass rwlock3.pass rwlock4.pass \
- rwlock5.pass rwlock6.pass rwlock7.pass rwlock8.pass \
- rwlock2_t.pass rwlock3_t.pass rwlock4_t.pass rwlock5_t.pass rwlock6_t.pass rwlock6_t2.pass \
- context1.pass \
- cancel3.pass cancel4.pass cancel5.pass cancel6a.pass cancel6d.pass \
- cancel7.pass cancel8.pass \
- cleanup0.pass cleanup1.pass cleanup2.pass cleanup3.pass \
- priority1.pass priority2.pass inherit1.pass \
- spin1.pass spin2.pass spin3.pass spin4.pass \
- exception1.pass exception2.pass exception3.pass \
- cancel9.pass stress1.pass
-
-BENCHRESULTS = \
- benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench
-
-STRESSRESULTS = \
- stress1.stress
-
-STATICRESULTS = \
- sizes.pass \
- self1.pass mutex5.pass \
- mutex1.pass mutex1n.pass mutex1e.pass mutex1r.pass \
- semaphore1.pass semaphore2.pass semaphore3.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 \
- sequence1.pass kill1.pass valid1.pass valid2.pass \
- exit2.pass exit3.pass exit4.pass exit5.pass \
- join0.pass join1.pass detach1.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 \
- robust1.pass robust2.pass robust3.pass robust4.pass robust5.pass \
- count1.pass \
- once1.pass once2.pass once3.pass once4.pass \
- self2.pass \
- cancel1.pass cancel2.pass \
- semaphore4.pass semaphore4t.pass semaphore5.pass \
- barrier1.pass barrier2.pass barrier3.pass barrier4.pass barrier5.pass barrier6.pass \
- tsd1.pass tsd2.pass delay1.pass delay2.pass eyal1.pass \
- condvar3.pass condvar3_1.pass condvar3_2.pass condvar3_3.pass \
- condvar4.pass condvar5.pass condvar6.pass \
- condvar7.pass condvar8.pass condvar9.pass \
- errno1.pass \
- rwlock1.pass rwlock2.pass rwlock3.pass rwlock4.pass \
- rwlock5.pass rwlock6.pass rwlock7.pass rwlock8.pass \
- rwlock2_t.pass rwlock3_t.pass rwlock4_t.pass rwlock5_t.pass rwlock6_t.pass rwlock6_t2.pass \
- context1.pass \
- cancel3.pass cancel4.pass cancel5.pass cancel6a.pass cancel6d.pass \
- cancel7.pass cancel8.pass \
- cleanup0.pass cleanup1.pass cleanup2.pass cleanup3.pass \
- priority1.pass priority2.pass inherit1.pass \
- spin1.pass spin2.pass spin3.pass spin4.pass \
- exception1.pass exception2.pass exception3.pass \
- cancel9.pass stress1.pass
+include common.mk
+
+#
+# To build and run "foo.exe" and "bar.exe" only use, e.g.:
+# nmake clean VC NO_DEPS=1 TESTS="foo bar"
+#
+# To build and run "foo.exe" and "bar.exe" and run all prerequisite tests
+# use, e.g.:
+# nmake clean VC TESTS="foo bar"
+#
+# Set TESTS to one or more tests.
+#
+!IFNDEF NO_DEPS
+include runorder.mk
+!ENDIF
help:
@ $(ECHO) Run one of the following command lines:
- @ $(ECHO) nmake clean VC (to test using VC dll with VC (no EH) apps)
- @ $(ECHO) nmake clean VC-bench (to benchtest using VC dll with C bench apps)
- @ $(ECHO) nmake clean VC-stress (to stresstest using VC dll with C stress apps)
- @ $(ECHO) nmake clean VC-static (to test using VC static lib with VC (no EH) apps)
- @ $(ECHO) nmake clean VCX (to test using VC dll with VC++ (EH) applications)
- @ $(ECHO) nmake clean VCX-bench (to benchtest using VC dll with C++ bench apps)
- @ $(ECHO) nmake clean VCX-stress (to stresstest using VC dll with C++ stress apps)
- @ $(ECHO) nmake clean VCE (to test using the VCE dll with VC++ EH applications)
- @ $(ECHO) nmake clean VCE-bench (to benchtest using VCE dll with C++ bench apps)
- @ $(ECHO) nmake clean VCE-stress (to stresstest using VCE dll with C++ stress apps)
- @ $(ECHO) nmake clean VSE (to test using VSE dll with VC (SEH) apps)
- @ $(ECHO) nmake clean VSE-bench (to benchtest using VSE dll with SEH bench apps)
- @ $(ECHO) nmake clean VSE-stress (to stresstest using VSE dll with SEH stress apps)
-
-all:
- @ $(MAKE) /E clean VC
- @ $(MAKE) /E clean VCX
- @ $(MAKE) /E clean VCE
- @ $(MAKE) /E clean VSE
- @ $(MAKE) /E clean VC-bench
- @ $(MAKE) /E clean VC-stress
-
-# This allows an individual test application to be made using the default lib.
-# e.g. nmake clean test cancel3.exe
-test: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC)
-
-tests: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC) $(PASSES)
- @ $(ECHO) ALL TESTS PASSED! Congratulations!
-
-benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(XXLIBS) $(BENCHRESULTS)
- @ $(ECHO) ALL BENCH TESTS DONE.
-
-stresstests: $(CPLIB) $(CPDLL) $(CPHDR) $(STRESSRESULTS)
- @ $(ECHO) ALL STRESS TESTS DONE.
-
-statictests: $(CPLIB) $(CPDLL) $(CPHDR) $(STATICRESULTS)
- @ $(ECHO) ALL STATIC TESTS DONE.
-
-sizes.pass: sizes.exe
- @ $(ECHO) ... Running $(TEST)$(DLL_VER) test: $*.exe
- @ .\$*.exe > SIZES.$(TEST)
- @ $(CAT) SIZES.$(TEST)
- @ $(ECHO) ...... Passed
- @ $(TOUCH) $*.pass
-
-$(REGULAR_PASSES): $*.exe
- @ $(ECHO) ... Running $(TEST) test: $*.exe
- @ .\$*.exe
- @ $(ECHO) ...... Passed
- @ $(TOUCH) $*.pass
-
-$(BENCHRESULTS): $*.exe
- @ $(ECHO) ... Running $(TEST) benchtest: $*.exe
- @ .\$*.exe
- @ $(ECHO) ...... Done
- @ $(TOUCH) $*.bench
-
-$(STRESSRESULTS): $*.exe
- @ $(ECHO) ... Running $(TEST) stresstest: $*.exe
- @ .\$*.exe
- @ $(ECHO) ...... Done
- @ $(TOUCH) $*.pass
+ @ $(ECHO) nmake clean VC
+ @ $(ECHO) nmake clean VC-bench
+ @ $(ECHO) nmake clean VC-static
+ @ $(ECHO) nmake clean VC-static-bench
+ @ $(ECHO) nmake clean VC-debug
+ @ $(ECHO) nmake clean VC-static-debug
+ @ $(ECHO) nmake clean VC-small-static-debug
+ @ $(ECHO) nmake clean VCX
+ @ $(ECHO) nmake clean VCX-bench
+ @ $(ECHO) nmake clean VCX-static
+ @ $(ECHO) nmake clean VCX-static-bench
+ @ $(ECHO) nmake clean VCX-debug
+ @ $(ECHO) nmake clean VCX-static-debug
+ @ $(ECHO) nmake clean VCX-small-static-debug
+ @ $(ECHO) nmake clean VCE
+ @ $(ECHO) nmake clean VCE-bench
+ @ $(ECHO) nmake clean VCE-static
+ @ $(ECHO) nmake clean VCE-static-bench
+ @ $(ECHO) nmake clean VCE-debug
+ @ $(ECHO) nmake clean VCE-static-debug
+ @ $(ECHO) nmake clean VCE-small-static-debug
+ @ $(ECHO) nmake clean VSE
+ @ $(ECHO) nmake clean VSE-bench
+ @ $(ECHO) nmake clean VSE-static
+ @ $(ECHO) nmake clean VSE-static-bench
+ @ $(ECHO) nmake clean VSE-debug
+ @ $(ECHO) nmake clean VSE-static-debug
+ @ $(ECHO) nmake clean VSE-small-static-debug
VC:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" tests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" allpassed
VCE:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" tests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" allpassed
VSE:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" allpassed
VCX:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" tests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" allpassed
VC-bench:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" XXLIBS="benchlib.o" benchtests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" $(BENCHTESTS)
VCE-bench:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" XXLIBS="benchlib.o" benchtests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" $(BENCHTESTS)
VSE-bench:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" XXLIBS="benchlib.o" benchtests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" $(BENCHTESTS)
VCX-bench:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" $(BENCHTESTS)
-VC-stress:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" stresstests
+VC-static VC-small-static:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" allpassed
-VCE-stress:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" stresstests
+VCE-static VCE-small-static:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIB)" CPDLL="" EHFLAGS="$(VCEFLAGS) /DPTW32_STATIC_LIB" allpassed
-VSE-stress:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" stresstests
+VSE-static VSE-small-static:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIB)" CPDLL="" EHFLAGS="$(VSEFLAGS) /DPTW32_STATIC_LIB" allpassed
-VCX-stress:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" stresstests
+VCX-static VCX-small-static:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCXFLAGS) /DPTW32_STATIC_LIB" allpassed
-VC-static:
- @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" statictests
+VC-static-bench:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" $(BENCHTESTS)
-.c.exe:
- @ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
- @ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
+VCE-static-bench:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIB)" CPDLL="" EHFLAGS="$(VCEFLAGS) /DPTW32_STATIC_LIB" $(BENCHTESTS)
-.c.o:
- @ $(ECHO) $(CC) $(EHFLAGS) /c $(CFLAGS) $(INCLUDES) $< /Fo$@
- @ $(CC) $(EHFLAGS) $(CFLAGS) /c $(INCLUDES) $< /Fo$@
+VSE-static-bench:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIB)" CPDLL="" EHFLAGS="$(VSEFLAGS) /DPTW32_STATIC_LIB" $(BENCHTESTS)
-.c.i:
- @ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
+VCX-static-bench:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCXFLAGS) /DPTW32_STATIC_LIB" $(BENCHTESTS)
+
+VC-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIBD)" CPDLL="$(VCDLLD)" EHFLAGS="$(VCFLAGS)" allpassed
+
+VC-static-debug VC-small-static-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIBD)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" allpassed
-$(COPYFILES):
- @ $(ECHO) Copying $(BUILD_DIR)\$@
- @ $(CP) $(BUILD_DIR)\$@ .
+VCE-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIBD)" CPDLL="$(VCEDLLD)" EHFLAGS="$(VCEFLAGS)" allpassed
-pthread.dll: $(CPDLL)
- @ $(CP) $(CPDLL) pthread.dll
- @ $(CP) $(CPLIB) pthread.lib
+VCE-static-debug VCE-small-static-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCELIBD)" CPDLL="" EHFLAGS="$(VCEFLAGS) /DPTW32_STATIC_LIB" allpassed
+
+VSE-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIBD)" CPDLL="$(VSEDLLD)" EHFLAGS="$(VSEFLAGS)" allpassed
+
+VSE-static-debug VSE-small-static-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VSELIBD)" CPDLL="" EHFLAGS="$(VSEFLAGS) /DPTW32_STATIC_LIB" allpassed
+
+VCX-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIBD)" CPDLL="$(VCDLLD)" EHFLAGS="$(VCXFLAGS)" allpassed
+
+VCX-static-debug VCX-small-static-debug:
+ @ $(MAKE) /E /nologo TEST="$@" CPLIB="$(VCLIBD)" CPDLL="" EHFLAGS="$(VCXFLAGS) /DPTW32_STATIC_LIB" allpassed
clean:
- - $(RM) *.dll
- - $(RM) *.lib
- - $(RM) pthread.h
- - $(RM) semaphore.h
- - $(RM) sched.h
- - $(RM) *.e
- - $(RM) *.i
- - $(RM) *.obj
- - $(RM) *.pdb
- - $(RM) *.o
- - $(RM) *.asm
- - $(RM) *.exe
- - $(RM) *.pass
- - $(RM) *.bench
- - $(RM) *.log
-
-benchtest1.bench:
-benchtest2.bench:
-benchtest3.bench:
-benchtest4.bench:
-benchtest5.bench:
-
-barrier1.pass: semaphore4.pass
-barrier2.pass: barrier1.pass
-barrier3.pass: barrier2.pass
-barrier4.pass: barrier3.pass
-barrier5.pass: barrier4.pass
-barrier6.pass: barrier5.pass
-cancel1.pass: create1.pass
-cancel2.pass: cancel1.pass
-cancel3.pass: context1.pass
-cancel4.pass: cancel3.pass
-cancel5.pass: cancel3.pass
-cancel6a.pass: cancel3.pass
-cancel6d.pass: cancel3.pass
-cancel7.pass: kill1.pass
-cancel8.pass: cancel7.pass
-cancel9.pass: cancel8.pass
-cleanup0.pass: cancel5.pass
-cleanup1.pass: cleanup0.pass
-cleanup2.pass: cleanup1.pass
-cleanup3.pass: cleanup2.pass
-condvar1.pass:
-condvar1_1.pass: condvar1.pass
-condvar1_2.pass: join2.pass
-condvar2.pass: condvar1.pass
-condvar2_1.pass: condvar2.pass join2.pass
-condvar3.pass: create1.pass condvar2.pass
-condvar3_1.pass: condvar3.pass join2.pass
-condvar3_2.pass: condvar3_1.pass
-condvar3_3.pass: condvar3_2.pass
-condvar4.pass: create1.pass
-condvar5.pass: condvar4.pass
-condvar6.pass: condvar5.pass
-condvar7.pass: condvar6.pass cleanup1.pass
-condvar8.pass: condvar7.pass
-condvar9.pass: condvar8.pass
-context1.pass: cancel1.pass
-count1.pass: join1.pass
-create1.pass: mutex2.pass
-create2.pass: create1.pass
-delay1.pass:
-delay2.pass: delay1.pass
-detach1.pass: join0.pass
-equal1.pass: create1.pass
-errno1.pass: mutex3.pass
-exception1.pass: cancel4.pass
-exception2.pass: exception1.pass
-exception3.pass: exception2.pass
-exit1.pass:
-exit2.pass: create1.pass
-exit3.pass: create1.pass
-exit4.pass:
-exit5.pass: kill1.pass
-eyal1.pass: tsd1.pass
-inherit1.pass: join1.pass priority1.pass
-join0.pass: create1.pass
-join1.pass: create1.pass
-join2.pass: create1.pass
-join3.pass: join2.pass
-kill1.pass:
-loadfree.pass: pthread.dll
-mutex1.pass: self1.pass
-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
-mutex7r.pass: mutex6r.pass
-mutex8.pass: mutex7.pass
-mutex8n.pass: mutex7n.pass
-mutex8e.pass: mutex7e.pass
-mutex8r.pass: mutex7r.pass
-once1.pass: create1.pass
-once2.pass: once1.pass
-once3.pass: once2.pass
-once4.pass: once3.pass
-priority1.pass: join1.pass
-priority2.pass: priority1.pass barrier3.pass
-reuse1.pass: create2.pass
-reuse2.pass: reuse1.pass
-robust1.pass: mutex8r.pass
-robust2.pass: mutex8r.pass
-robust3.pass: robust2.pass
-robust4.pass: robust3.pass
-robust5.pass: robust4.pass
-rwlock1.pass: condvar6.pass
-rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.pass join2.pass
-rwlock4.pass: rwlock3.pass
-rwlock5.pass: rwlock4.pass
-rwlock6.pass: rwlock5.pass
-rwlock7.pass: rwlock6.pass
-rwlock8.pass: rwlock7.pass
-rwlock2_t.pass: rwlock2.pass
-rwlock3_t.pass: rwlock2_t.pass
-rwlock4_t.pass: rwlock3_t.pass
-rwlock5_t.pass: rwlock4_t.pass
-rwlock6_t.pass: rwlock5_t.pass
-rwlock6_t2.pass: rwlock6_t.pass
-self1.pass:
-self2.pass: create1.pass
-semaphore1.pass:
-semaphore2.pass:
-semaphore3.pass: semaphore2.pass
-semaphore4.pass: semaphore3.pass cancel1.pass
-semaphore4t.pass: semaphore4.pass
-semaphore5.pass: semaphore4.pass
-sequence1.pass: reuse2.pass
-sizes.pass:
-spin1.pass:
-spin2.pass: spin1.pass
-spin3.pass: spin2.pass
-spin4.pass: spin3.pass
-stress1.pass: condvar9.pass barrier5.pass
-tsd1.pass: barrier5.pass join1.pass
-tsd2.pass: tsd1.pass
-valid1.pass: join1.pass
-valid2.pass: valid1.pass
+ if exist *.dll $(RM) *.dll
+ if exist *.lib $(RM) *.lib
+ if exist pthread.h $(RM) pthread.h
+ if exist semaphore.h $(RM) semaphore.h
+ if exist sched.h $(RM) sched.h
+ if exist *.e $(RM) *.e
+ if exist *.i $(RM) *.i
+ if exist *.obj $(RM) *.obj
+ if exist *.pdb $(RM) *.pdb
+ if exist *.o $(RM) *.o
+ if exist *.asm $(RM) *.asm
+ if exist *.exe $(RM) *.exe
+ if exist *.manifest $(RM) *.manifest
+ if exist *.pass $(RM) *.pass
+ if exist *.bench $(RM) *.bench
+ if exist *.log $(RM) *.log
+
+.c.pass:
+ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $*.c /Fe$*.exe /link $(LFLAGS) $(CPLIB) $(XXLIBS)
+ @ $(ECHO) ... Running $(TEST) test: $*.exe
+ @ .\$*.exe
+ @ $(ECHO) ...... Passed
+ @ $(TOUCH) $*.pass
+
+$(ALL_KNOWN_TESTS): $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC) $@.pass
+
+allpassed: $(TESTS)
+ @ $(ECHO) ALL TESTS PASSED! Congratulations!
+
+$(BENCHTESTS): $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
+ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) benchlib.c $*.c /Fe$*.exe /link $(LFLAGS) $(CPLIB) $(XXLIBS)
+ @ $(ECHO) ... Running $(TEST) benchmark: $*.exe
+ @ .\$*.exe
+ @ $(ECHO) ...... Done
+
+.c.i:
+ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
+
+$(CPHDR) $(CPLIB) $(CPDLL) $(QAPC):
+ @ if exist $(BUILD_DIR)\$@ $(ECHO) Copying $(BUILD_DIR)\$@ && $(CP) $(BUILD_DIR)\$@ .
diff --git a/pthreads/tests/SIZES.GC b/pthreads/tests/SIZES.GC
deleted file mode 100644
index d5ddf363f..000000000
--- a/pthreads/tests/SIZES.GC
+++ /dev/null
@@ -1,21 +0,0 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t 8
- ptw32_thread_t 160
- pthread_attr_t_ 28
- sem_t_ 12
- pthread_mutex_t_ 28
- pthread_mutexattr_t_ 12
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 36
- pthread_barrierattr_t_ 4
- pthread_key_t_ 16
- pthread_cond_t_ 32
- pthread_condattr_t_ 4
- pthread_rwlock_t_ 28
- pthread_rwlockattr_t_ 4
- pthread_once_t_ 16
- ptw32_cleanup_t 12
- ptw32_mcs_node_t_ 16
- sched_param 4
--------------------------------
diff --git a/pthreads/tests/SIZES.GCE b/pthreads/tests/SIZES.GCE
deleted file mode 100644
index 709114d52..000000000
--- a/pthreads/tests/SIZES.GCE
+++ /dev/null
@@ -1,21 +0,0 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t 8
- ptw32_thread_t 96
- pthread_attr_t_ 28
- sem_t_ 12
- pthread_mutex_t_ 28
- pthread_mutexattr_t_ 12
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 36
- pthread_barrierattr_t_ 4
- pthread_key_t_ 16
- pthread_cond_t_ 32
- pthread_condattr_t_ 4
- pthread_rwlock_t_ 28
- pthread_rwlockattr_t_ 4
- pthread_once_t_ 16
- ptw32_cleanup_t 12
- ptw32_mcs_node_t_ 16
- sched_param 4
--------------------------------
diff --git a/pthreads/tests/SIZES.VC b/pthreads/tests/SIZES.VC
deleted file mode 100644
index d5ddf363f..000000000
--- a/pthreads/tests/SIZES.VC
+++ /dev/null
@@ -1,21 +0,0 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t 8
- ptw32_thread_t 160
- pthread_attr_t_ 28
- sem_t_ 12
- pthread_mutex_t_ 28
- pthread_mutexattr_t_ 12
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 36
- pthread_barrierattr_t_ 4
- pthread_key_t_ 16
- pthread_cond_t_ 32
- pthread_condattr_t_ 4
- pthread_rwlock_t_ 28
- pthread_rwlockattr_t_ 4
- pthread_once_t_ 16
- ptw32_cleanup_t 12
- ptw32_mcs_node_t_ 16
- sched_param 4
--------------------------------
diff --git a/pthreads/tests/SIZES.VCE b/pthreads/tests/SIZES.VCE
deleted file mode 100644
index 709114d52..000000000
--- a/pthreads/tests/SIZES.VCE
+++ /dev/null
@@ -1,21 +0,0 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t 8
- ptw32_thread_t 96
- pthread_attr_t_ 28
- sem_t_ 12
- pthread_mutex_t_ 28
- pthread_mutexattr_t_ 12
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 36
- pthread_barrierattr_t_ 4
- pthread_key_t_ 16
- pthread_cond_t_ 32
- pthread_condattr_t_ 4
- pthread_rwlock_t_ 28
- pthread_rwlockattr_t_ 4
- pthread_once_t_ 16
- ptw32_cleanup_t 12
- ptw32_mcs_node_t_ 16
- sched_param 4
--------------------------------
diff --git a/pthreads/tests/SIZES.VSE b/pthreads/tests/SIZES.VSE
deleted file mode 100644
index 709114d52..000000000
--- a/pthreads/tests/SIZES.VSE
+++ /dev/null
@@ -1,21 +0,0 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t 8
- ptw32_thread_t 96
- pthread_attr_t_ 28
- sem_t_ 12
- pthread_mutex_t_ 28
- pthread_mutexattr_t_ 12
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 36
- pthread_barrierattr_t_ 4
- pthread_key_t_ 16
- pthread_cond_t_ 32
- pthread_condattr_t_ 4
- pthread_rwlock_t_ 28
- pthread_rwlockattr_t_ 4
- pthread_once_t_ 16
- ptw32_cleanup_t 12
- ptw32_mcs_node_t_ 16
- sched_param 4
--------------------------------
diff --git a/pthreads/tests/Wmakefile b/pthreads/tests/Wmakefile
index 2b37c4691..284f326cd 100644
--- a/pthreads/tests/Wmakefile
+++ b/pthreads/tests/Wmakefile
@@ -5,7 +5,7 @@
#
# Pthreads-win32 - POSIX Threads Library for Win32
# Copyright(C) 1998 John E. Bossom
-# Copyright(C) 1999,2005 Pthreads-win32 contributors
+# Copyright(C) 1999,2012 Pthreads-win32 contributors
#
# Contact Email: rpj@callisto.canberra.edu.au
#
@@ -62,7 +62,7 @@ WCDLL = pthreadWC$(DLL_VER).dll
# C++ Exceptions in application - using WC version of pthreads dll
WCXFLAGS = -xs -d__CLEANUP_C
-CFLAGS= -w4 -e25 -d_WIN32_WINNT=0x400 -d_REENTRANT -zq -bm $(OPTIM) -5r -bt=nt -mf -d2
+CFLAGS= -w4 -e25 -d_REENTRANT -zq -bm $(OPTIM) -5r -bt=nt -mf -d2
LFLAGS=
INCLUDES= -i=.
@@ -79,7 +79,7 @@ EHFLAGS =
# If a test case returns a non-zero exit code to the shell, make will
# stop.
-PASSES = sizes.pass loadfree.pass &
+PASSES = sizes.pass &
self1.pass mutex5.pass &
mutex1.pass mutex1n.pass mutex1e.pass mutex1r.pass &
semaphore1.pass semaphore2.pass semaphore3.pass &
@@ -89,7 +89,7 @@ PASSES = sizes.pass loadfree.pass &
exit1.pass create1.pass create2.pass reuse1.pass reuse2.pass equal1.pass &
sequence1.pass kill1.pass valid1.pass valid2.pass &
exit2.pass exit3.pass exit4 exit5 &
- join0.pass join1.pass detach1.pass join2.pass join3.pass &
+ join0.pass join1.pass detach1.pass join2.pass join3.pass join4.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 &
@@ -115,8 +115,10 @@ PASSES = sizes.pass loadfree.pass &
priority1.pass priority2.pass inherit1.pass &
spin1.pass spin2.pass spin3.pass spin4.pass &
barrier1.pass barrier2.pass barrier3.pass barrier4.pass barrier5.pass &
- exception1.pass exception2.pass exception3.pass &
- cancel9.pass stress1.pass
+ exception1.pass exception2.pass exception3_0.pass exception3.pass &
+ cancel9.pass &
+ affinity1.pass affinity2.pass affinity3.pass affinity4.pass affinity5.pass &
+ stress1.pass
BENCHRESULTS = &
benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench
@@ -213,6 +215,7 @@ clean: .SYMBOLIC
@ if exist *.o $(RM) *.o
@ if exist *.asm $(RM) *.asm
@ if exist *.exe $(RM) *.exe
+ @ if exist *.manifest $(RM) *.manifest
@ if exist *.pass $(RM) *.pass
@ if exist *.bench $(RM) *.bench
@ if exist *.log $(RM) *.log
@@ -223,7 +226,13 @@ benchtest2.bench:
benchtest3.bench:
benchtest4.bench:
benchtest5.bench:
-barrier1.pass:
+
+affinity1.pass:
+affinity2.pass: affinity1.pass
+affinity3.pass: affinity2.pass
+affinity4.pass: affinity3.pass
+affinity5.pass: affinity4.pass
+barrier1.pass: semaphore4.pass
barrier2.pass: barrier1.pass
barrier3.pass: barrier2.pass
barrier4.pass: barrier3.pass
@@ -267,7 +276,8 @@ equal1.pass: create1.pass
errno1.pass: mutex3.pass
exception1.pass: cancel4.pass
exception2.pass: exception1.pass
-exception3.pass: exception2.pass
+exception3_0.pass: exception2.pass
+exception3.pass: exception3_0.pass
exit1.pass:
exit2.pass: create1.pass
exit3.pass: create1.pass
@@ -279,8 +289,8 @@ join0.pass: create1.pass
join1.pass: create1.pass
join2.pass: create1.pass
join3.pass: join2.pass
+join4.pass: join3.pass
kill1.pass:
-loadfree.pass: pthread.dll
mutex1.pass: self1.pass
mutex1n.pass: mutex1.pass
mutex1e.pass: mutex1.pass
diff --git a/pthreads/tests/affinity1.c b/pthreads/tests/affinity1.c
new file mode 100755
index 000000000..7014d8875
--- /dev/null
+++ b/pthreads/tests/affinity1.c
@@ -0,0 +1,111 @@
+/*
+ * affinity1.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Basic test of CPU_*() support routines.
+ *
+ */
+
+#include "test.h"
+
+int
+main()
+{
+ unsigned int cpu;
+ cpu_set_t newmask;
+ cpu_set_t src1mask;
+ cpu_set_t src2mask;
+ cpu_set_t src3mask;
+
+ CPU_ZERO(&newmask);
+ CPU_ZERO(&src1mask);
+ memset(&src2mask, 0, sizeof(cpu_set_t));
+ assert(memcmp(&src1mask, &src2mask, sizeof(cpu_set_t)) == 0);
+ assert(CPU_EQUAL(&src1mask, &src2mask));
+ assert(CPU_COUNT(&src1mask) == 0);
+
+ CPU_ZERO(&src1mask);
+ CPU_ZERO(&src2mask);
+ CPU_ZERO(&src3mask);
+
+ for (cpu = 0; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &src1mask); /* 0b01010101010101010101010101010101 */
+ }
+ for (cpu = 0; cpu < sizeof(cpu_set_t)*4; cpu++)
+ {
+ CPU_SET(cpu, &src2mask); /* 0b00000000000000001111111111111111 */
+ }
+ for (cpu = sizeof(cpu_set_t)*4; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &src2mask); /* 0b01010101010101011111111111111111 */
+ }
+ for (cpu = 0; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &src3mask); /* 0b01010101010101010101010101010101 */
+ }
+
+ assert(CPU_COUNT(&src1mask) == (sizeof(cpu_set_t)*4));
+ assert(CPU_COUNT(&src2mask) == ((sizeof(cpu_set_t)*4 + (sizeof(cpu_set_t)*2))));
+ assert(CPU_COUNT(&src3mask) == (sizeof(cpu_set_t)*4));
+ CPU_SET(0, &newmask);
+ CPU_SET(1, &newmask);
+ CPU_SET(3, &newmask);
+ assert(CPU_ISSET(1, &newmask));
+ CPU_CLR(1, &newmask);
+ assert(!CPU_ISSET(1, &newmask));
+ CPU_OR(&newmask, &src1mask, &src2mask);
+ assert(CPU_EQUAL(&newmask, &src2mask));
+ CPU_AND(&newmask, &src1mask, &src2mask);
+ assert(CPU_EQUAL(&newmask, &src1mask));
+ CPU_XOR(&newmask, &src1mask, &src3mask);
+ memset(&src2mask, 0, sizeof(cpu_set_t));
+ assert(memcmp(&newmask, &src2mask, sizeof(cpu_set_t)) == 0);
+
+ /*
+ * Need to confirm the bitwise logical right-shift in CpuCount().
+ * i.e. zeros inserted into MSB on shift because cpu_set_t is
+ * unsigned.
+ */
+ CPU_ZERO(&src1mask);
+ for (cpu = 1; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &src1mask); /* 0b10101010101010101010101010101010 */
+ }
+ assert(CPU_ISSET(sizeof(cpu_set_t)*8-1, &src1mask));
+ assert(CPU_COUNT(&src1mask) == (sizeof(cpu_set_t)*4));
+
+ return 0;
+}
diff --git a/pthreads/tests/affinity2.c b/pthreads/tests/affinity2.c
new file mode 100755
index 000000000..225840cf1
--- /dev/null
+++ b/pthreads/tests/affinity2.c
@@ -0,0 +1,102 @@
+/*
+ * affinity2.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Have the process switch CPUs.
+ *
+ */
+
+#include "test.h"
+
+int
+main()
+{
+ unsigned int cpu;
+ int result;
+ cpu_set_t newmask;
+ cpu_set_t mask;
+ cpu_set_t switchmask;
+ cpu_set_t flipmask;
+
+ CPU_ZERO(&mask);
+ CPU_ZERO(&switchmask);
+ CPU_ZERO(&flipmask);
+
+ for (cpu = 0; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &switchmask); /* 0b01010101010101010101010101010101 */
+ }
+ for (cpu = 0; cpu < sizeof(cpu_set_t)*8; cpu++)
+ {
+ CPU_SET(cpu, &flipmask); /* 0b11111111111111111111111111111111 */
+ }
+
+ assert(sched_getaffinity(0, sizeof(cpu_set_t), &newmask) == 0);
+ assert(!CPU_EQUAL(&newmask, &mask));
+
+ result = sched_setaffinity(0, sizeof(cpu_set_t), &newmask);
+ if (result != 0)
+ {
+ int err =
+#if defined(PTW32_USES_SEPARATE_CRT)
+ GetLastError();
+#else
+ errno;
+#endif
+
+ assert(err != ESRCH);
+ assert(err != EFAULT);
+ assert(err != EPERM);
+ assert(err != EINVAL);
+ assert(err != EAGAIN);
+ assert(err == ENOSYS);
+ assert(CPU_COUNT(&mask) == 1);
+ }
+ else
+ {
+ if (CPU_COUNT(&mask) > 1)
+ {
+ CPU_AND(&newmask, &mask, &switchmask); /* Remove every other CPU */
+ assert(sched_setaffinity(0, sizeof(cpu_set_t), &newmask) == 0);
+ assert(sched_getaffinity(0, sizeof(cpu_set_t), &mask) == 0);
+ CPU_XOR(&newmask, &mask, &flipmask); /* Switch to all alternative CPUs */
+ assert(sched_setaffinity(0, sizeof(cpu_set_t), &newmask) == 0);
+ assert(sched_getaffinity(0, sizeof(cpu_set_t), &mask) == 0);
+ assert(!CPU_EQUAL(&newmask, &mask));
+ }
+ }
+
+ return 0;
+}
diff --git a/pthreads/tests/affinity3.c b/pthreads/tests/affinity3.c
new file mode 100755
index 000000000..065dd21a4
--- /dev/null
+++ b/pthreads/tests/affinity3.c
@@ -0,0 +1,100 @@
+/*
+ * affinity3.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Have the thread switch CPUs.
+ *
+ */
+
+#include "test.h"
+
+int
+main()
+{
+ int result;
+ unsigned int cpu;
+ cpu_set_t newmask;
+ cpu_set_t processCpus;
+ cpu_set_t mask;
+ cpu_set_t switchmask;
+ cpu_set_t flipmask;
+ pthread_t self = pthread_self();
+
+ CPU_ZERO(&mask);
+ CPU_ZERO(&switchmask);
+ CPU_ZERO(&flipmask);
+
+ assert(pthread_getaffinity_np(self, sizeof(cpu_set_t), &processCpus) == 0);
+ printf("This thread has a starting affinity with %d CPUs\n", CPU_COUNT(&processCpus));
+ assert(!CPU_EQUAL(&mask, &processCpus));
+
+ for (cpu = 0; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &switchmask); /* 0b01010101010101010101010101010101 */
+ }
+ for (cpu = 0; cpu < sizeof(cpu_set_t)*8; cpu++)
+ {
+ CPU_SET(cpu, &flipmask); /* 0b11111111111111111111111111111111 */
+ }
+
+ result = pthread_setaffinity_np(self, sizeof(cpu_set_t), &processCpus);
+ if (result != 0)
+ {
+ assert(result != ESRCH);
+ assert(result != EFAULT);
+ assert(result != EPERM);
+ assert(result != EINVAL);
+ assert(result != EAGAIN);
+ assert(result == ENOSYS);
+ assert(CPU_COUNT(&mask) == 1);
+ }
+ else
+ {
+ if (CPU_COUNT(&mask) > 1)
+ {
+ CPU_AND(&newmask, &processCpus, &switchmask); /* Remove every other CPU */
+ assert(pthread_setaffinity_np(self, sizeof(cpu_set_t), &newmask) == 0);
+ assert(pthread_getaffinity_np(self, sizeof(cpu_set_t), &mask) == 0);
+ assert(CPU_EQUAL(&mask, &newmask));
+ CPU_XOR(&newmask, &mask, &flipmask); /* Switch to all alternative CPUs */
+ assert(!CPU_EQUAL(&mask, &newmask));
+ assert(pthread_setaffinity_np(self, sizeof(cpu_set_t), &newmask) == 0);
+ assert(pthread_getaffinity_np(self, sizeof(cpu_set_t), &mask) == 0);
+ assert(CPU_EQUAL(&mask, &newmask));
+ }
+ }
+
+ return 0;
+}
diff --git a/pthreads/tests/affinity4.c b/pthreads/tests/affinity4.c
new file mode 100755
index 000000000..31aad46c2
--- /dev/null
+++ b/pthreads/tests/affinity4.c
@@ -0,0 +1,70 @@
+/*
+ * affinity4.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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 thread CPU affinity setting.
+ *
+ */
+
+#include "test.h"
+
+int
+main()
+{
+ unsigned int cpu;
+ cpu_set_t threadCpus;
+ DWORD_PTR vThreadMask;
+ cpu_set_t keepCpus;
+ pthread_t self = pthread_self();
+
+ CPU_ZERO(&keepCpus);
+ for (cpu = 1; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &keepCpus); /* 0b10101010101010101010101010101010 */
+ }
+
+ assert(pthread_getaffinity_np(self, sizeof(cpu_set_t), &threadCpus) == 0);
+ if (CPU_COUNT(&threadCpus) > 1)
+ {
+ CPU_AND(&threadCpus, &threadCpus, &keepCpus);
+ vThreadMask = SetThreadAffinityMask(GetCurrentThread(), (*(PDWORD_PTR)&threadCpus) /* Violating Opacity */);
+ assert(pthread_setaffinity_np(self, sizeof(cpu_set_t), &threadCpus) == 0);
+ vThreadMask = SetThreadAffinityMask(GetCurrentThread(), vThreadMask);
+ assert(vThreadMask != 0);
+ assert(memcmp(&vThreadMask, &threadCpus, sizeof(DWORD_PTR)) == 0);
+ }
+
+ return 0;
+}
diff --git a/pthreads/tests/affinity5.c b/pthreads/tests/affinity5.c
new file mode 100755
index 000000000..8957e28f0
--- /dev/null
+++ b/pthreads/tests/affinity5.c
@@ -0,0 +1,103 @@
+/*
+ * affinity5.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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 thread CPU affinity inheritance.
+ *
+ */
+
+#include "test.h"
+
+typedef union
+{
+ /* Violates opacity */
+ cpu_set_t cpuset;
+ unsigned long int bits; /* To stop GCC complaining about %lx args to printf */
+} cpuset_to_ulint;
+
+void *
+mythread(void * arg)
+{
+ HANDLE threadH = GetCurrentThread();
+ cpu_set_t *parentCpus = (cpu_set_t*) arg;
+ cpu_set_t threadCpus;
+ DWORD_PTR vThreadMask;
+ cpuset_to_ulint a, b;
+
+ assert(pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &threadCpus) == 0);
+ assert(CPU_EQUAL(parentCpus, &threadCpus));
+ vThreadMask = SetThreadAffinityMask(threadH, (*(PDWORD_PTR)&threadCpus) /* Violating Opacity */);
+ assert(vThreadMask != 0);
+ assert(memcmp(&vThreadMask, &threadCpus, sizeof(DWORD_PTR)) == 0);
+ a.cpuset = *parentCpus;
+ b.cpuset = threadCpus;
+ /* Violates opacity */
+ printf("CPU affinity: Parent/Thread = 0x%lx/0x%lx\n", a.bits, b.bits);
+
+ return (void*) 0;
+}
+
+int
+main()
+{
+ unsigned int cpu;
+ pthread_t tid;
+ cpu_set_t threadCpus;
+ DWORD_PTR vThreadMask;
+ cpu_set_t keepCpus;
+ pthread_t self = pthread_self();
+
+ CPU_ZERO(&keepCpus);
+ for (cpu = 1; cpu < sizeof(cpu_set_t)*8; cpu += 2)
+ {
+ CPU_SET(cpu, &keepCpus); /* 0b10101010101010101010101010101010 */
+ }
+
+ assert(pthread_getaffinity_np(self, sizeof(cpu_set_t), &threadCpus) == 0);
+ if (CPU_COUNT(&threadCpus) > 1)
+ {
+ assert(pthread_create(&tid, NULL, mythread, (void*)&threadCpus) == 0);
+ assert(pthread_join(tid, NULL) == 0);
+ CPU_AND(&threadCpus, &threadCpus, &keepCpus);
+ assert(pthread_setaffinity_np(self, sizeof(cpu_set_t), &threadCpus) == 0);
+ vThreadMask = SetThreadAffinityMask(GetCurrentThread(), (*(PDWORD_PTR)&threadCpus) /* Violating Opacity */);
+ assert(vThreadMask != 0);
+ assert(memcmp(&vThreadMask, &threadCpus, sizeof(DWORD_PTR)) == 0);
+ assert(pthread_create(&tid, NULL, mythread, (void*)&threadCpus) == 0);
+ assert(pthread_join(tid, NULL) == 0);
+ }
+
+ return 0;
+}
diff --git a/pthreads/tests/barrier1.c b/pthreads/tests/barrier1.c
index 76f78df66..cff727b9d 100644
--- a/pthreads/tests/barrier1.c
+++ b/pthreads/tests/barrier1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/barrier2.c b/pthreads/tests/barrier2.c
index 28aa238c5..1afd8d070 100644
--- a/pthreads/tests/barrier2.c
+++ b/pthreads/tests/barrier2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/barrier3.c b/pthreads/tests/barrier3.c
index dece77068..a3145519b 100644
--- a/pthreads/tests/barrier3.c
+++ b/pthreads/tests/barrier3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/barrier4.c b/pthreads/tests/barrier4.c
index 042992dfd..7c427e58b 100644
--- a/pthreads/tests/barrier4.c
+++ b/pthreads/tests/barrier4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/barrier5.c b/pthreads/tests/barrier5.c
index 353384081..86e698380 100644
--- a/pthreads/tests/barrier5.c
+++ b/pthreads/tests/barrier5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/barrier6.c b/pthreads/tests/barrier6.c
index 76c673779..d4d821454 100644
--- a/pthreads/tests/barrier6.c
+++ b/pthreads/tests/barrier6.c
@@ -1,117 +1,118 @@
-/*
- * barrier6.c
- *
- *
- * --------------------------------------------------------------------------
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 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
- *
- * --------------------------------------------------------------------------
- *
- * Destroy the barrier after initial count threads are released then let
- * additional threads attempt to wait on it.
- *
- */
-
-#include "test.h"
-
-enum {
- NUMTHREADS = 31
-};
-
-pthread_barrier_t barrier = NULL;
-pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
-static int serialThreadCount = 0;
-static int otherThreadCount = 0;
-
-void *
-func(void * arg)
-{
- int result = pthread_barrier_wait(&barrier);
-
- assert(pthread_mutex_lock(&mx) == 0);
-
- if (result == PTHREAD_BARRIER_SERIAL_THREAD)
- {
- serialThreadCount++;
- }
- else if (0 == result)
- {
- otherThreadCount++;
- }
- assert(pthread_mutex_unlock(&mx) == 0);
-
- return NULL;
-}
-
-int
-main()
-{
- int i, j, k;
- pthread_t t[NUMTHREADS + 1];
-
- for (j = 1; j <= NUMTHREADS; j++)
- {
- int howHigh = j/2 + 1;
-
- printf("Barrier height = %d, Total threads %d\n", howHigh, j);
-
- serialThreadCount = 0;
- otherThreadCount = 0;
-
- assert(pthread_barrier_init(&barrier, NULL, howHigh) == 0);
-
- for (i = 1; i <= j; i++)
- {
- assert(pthread_create(&t[i], NULL, func, NULL) == 0);
-
- if (i == howHigh)
- {
- for (k = 1; k <= howHigh; k++)
- {
- assert(pthread_join(t[k], NULL) == 0);
- }
- assert(pthread_barrier_destroy(&barrier) == 0);
- }
- }
-
- for (i = howHigh+1; i <= j; i++)
- {
- assert(pthread_join(t[i], NULL) == 0);
- }
-
- assert(serialThreadCount == 1);
- assert(otherThreadCount == (howHigh - 1));
-
- assert(pthread_barrier_destroy(&barrier) == EINVAL);
- }
-
- assert(pthread_mutex_destroy(&mx) == 0);
-
- return 0;
-}
+/*
+ * barrier6.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Destroy the barrier after initial count threads are released then let
+ * additional threads attempt to wait on it.
+ *
+ */
+
+#include "test.h"
+
+enum {
+ NUMTHREADS = 31
+};
+
+pthread_barrier_t barrier = NULL;
+pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
+static int serialThreadCount = 0;
+static int otherThreadCount = 0;
+
+void *
+func(void * arg)
+{
+ int result = pthread_barrier_wait(&barrier);
+
+ assert(pthread_mutex_lock(&mx) == 0);
+
+ if (result == PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ serialThreadCount++;
+ }
+ else if (0 == result)
+ {
+ otherThreadCount++;
+ }
+ assert(pthread_mutex_unlock(&mx) == 0);
+
+ return NULL;
+}
+
+int
+main()
+{
+ int i, j, k;
+ pthread_t t[NUMTHREADS + 1];
+
+ for (j = 1; j <= NUMTHREADS; j++)
+ {
+ int howHigh = j/2 + 1;
+
+ printf("Barrier height = %d, Total threads %d\n", howHigh, j);
+
+ serialThreadCount = 0;
+ otherThreadCount = 0;
+
+ assert(pthread_barrier_init(&barrier, NULL, howHigh) == 0);
+
+ for (i = 1; i <= j; i++)
+ {
+ assert(pthread_create(&t[i], NULL, func, NULL) == 0);
+
+ if (i == howHigh)
+ {
+ for (k = 1; k <= howHigh; k++)
+ {
+ assert(pthread_join(t[k], NULL) == 0);
+ }
+ assert(pthread_barrier_destroy(&barrier) == 0);
+ }
+ }
+
+ for (i = howHigh+1; i <= j; i++)
+ {
+ assert(pthread_join(t[i], NULL) == 0);
+ }
+
+ assert(serialThreadCount == 1);
+ assert(otherThreadCount == (howHigh - 1));
+
+ assert(pthread_barrier_destroy(&barrier) == EINVAL);
+ }
+
+ assert(pthread_mutex_destroy(&mx) == 0);
+
+ return 0;
+}
diff --git a/pthreads/tests/benchlib.c b/pthreads/tests/benchlib.c
index bf60ae515..d8f31ebd9 100644
--- a/pthreads/tests/benchlib.c
+++ b/pthreads/tests/benchlib.c
@@ -5,10 +5,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/benchtest.h b/pthreads/tests/benchtest.h
index 809057810..81f132c8b 100644
--- a/pthreads/tests/benchtest.h
+++ b/pthreads/tests/benchtest.h
@@ -5,10 +5,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/benchtest1.c b/pthreads/tests/benchtest1.c
index 191f98636..ea5810430 100644
--- a/pthreads/tests/benchtest1.c
+++ b/pthreads/tests/benchtest1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -40,7 +41,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
#ifdef __GNUC__
#include <stdlib.h>
diff --git a/pthreads/tests/benchtest2.c b/pthreads/tests/benchtest2.c
index 10f3d0ee8..bab680db9 100644
--- a/pthreads/tests/benchtest2.c
+++ b/pthreads/tests/benchtest2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -43,7 +44,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
#ifdef __GNUC__
#include <stdlib.h>
diff --git a/pthreads/tests/benchtest3.c b/pthreads/tests/benchtest3.c
index 7d03ed884..fc0e261df 100644
--- a/pthreads/tests/benchtest3.c
+++ b/pthreads/tests/benchtest3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -40,7 +41,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
#ifdef __GNUC__
#include <stdlib.h>
diff --git a/pthreads/tests/benchtest4.c b/pthreads/tests/benchtest4.c
index d7cf47c3b..0f59537fe 100644
--- a/pthreads/tests/benchtest4.c
+++ b/pthreads/tests/benchtest4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -40,7 +41,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
#ifdef __GNUC__
#include <stdlib.h>
diff --git a/pthreads/tests/benchtest5.c b/pthreads/tests/benchtest5.c
index d262baf11..9371ec5e0 100644
--- a/pthreads/tests/benchtest5.c
+++ b/pthreads/tests/benchtest5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -40,7 +41,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
#ifdef __GNUC__
#include <stdlib.h>
diff --git a/pthreads/tests/cancel1.c b/pthreads/tests/cancel1.c
index 23d2726a2..f93c497b4 100644
--- a/pthreads/tests/cancel1.c
+++ b/pthreads/tests/cancel1.c
@@ -6,26 +6,27 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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.,
@@ -34,26 +35,26 @@
* --------------------------------------------------------------------------
*
* Test Synopsis: Test setting cancel state and cancel type.
- * -
+ * -
*
* Test Method (Validation or Falsification):
- * -
+ * -
*
* Requirements Tested:
* - pthread_setcancelstate function
* - pthread_setcanceltype function
*
* Features Tested:
- * -
+ * -
*
* Cases Tested:
- * -
+ * -
*
* Description:
- * -
+ * -
*
* Environment:
- * -
+ * -
*
* Input:
* - None.
@@ -139,7 +140,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
/*
@@ -151,7 +152,7 @@ main()
* Standard check that all threads started.
*/
for (i = 1; i <= NUMTHREADS; i++)
- {
+ {
failed = !threadbag[i].started;
if (failed)
@@ -163,10 +164,10 @@ main()
assert(!failed);
/*
- * Check any results here. Set "failed" and only print ouput on failure.
+ * Check any results here. Set "failed" and only print output on failure.
*/
for (i = 1; i <= NUMTHREADS; i++)
- {
+ {
/* ... */
}
diff --git a/pthreads/tests/cancel2.c b/pthreads/tests/cancel2.c
index 2ee596abb..941061369 100644
--- a/pthreads/tests/cancel2.c
+++ b/pthreads/tests/cancel2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -95,7 +96,7 @@ struct bag_t_ {
static bag_t threadbag[NUMTHREADS + 1];
-static pthread_mutex_t waitLock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_barrier_t go = NULL;
void *
mythread(void * arg)
@@ -110,18 +111,8 @@ mythread(void * arg)
/* Set to known state and type */
assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0);
-
- switch (bag->threadnum % 2)
- {
- case 0:
- assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0);
- result = 0;
- break;
- case 1:
- assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0);
- result = 1;
- break;
- }
+ assert(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) == 0);
+ result = 1;
#if !defined(__cplusplus)
__try
@@ -130,14 +121,10 @@ mythread(void * arg)
#endif
{
/* Wait for go from main */
- assert(pthread_mutex_lock(&waitLock) == 0);
- assert(pthread_mutex_unlock(&waitLock) == 0);
- sched_yield();
+ pthread_barrier_wait(&go);
+ pthread_barrier_wait(&go);
- for (;;)
- {
- pthread_testcancel();
- }
+ pthread_testcancel();
}
#if !defined(__cplusplus)
__except(EXCEPTION_EXECUTE_HANDLER)
@@ -160,7 +147,7 @@ mythread(void * arg)
*/
result += 1000;
- return (void *) (size_t)result;
+ return (void *)(size_t)result;
}
int
@@ -171,7 +158,7 @@ main()
pthread_t t[NUMTHREADS + 1];
assert((t[0] = pthread_self()).p != NULL);
- assert(pthread_mutex_lock(&waitLock) == 0);
+ assert(pthread_barrier_init(&go, NULL, NUMTHREADS + 1) == 0);
for (i = 1; i <= NUMTHREADS; i++)
{
@@ -181,23 +168,17 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
- Sleep(500);
- assert(pthread_mutex_unlock(&waitLock) == 0);
-
- Sleep(500);
+ pthread_barrier_wait(&go);
for (i = 1; i <= NUMTHREADS; i++)
{
assert(pthread_cancel(t[i]) == 0);
}
- /*
- * Give threads time to run.
- */
- Sleep(NUMTHREADS * 100);
+ pthread_barrier_wait(&go);
/*
* Standard check that all threads started.
@@ -223,19 +204,19 @@ main()
void* result = (void*)0;
assert(pthread_join(t[i], &result) == 0);
- fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
- fprintf(stderr, "Thread %d: started %d: location %d: cancel type %s\n",
+ fprintf(stderr, "Thread %d: started %d: location %d\n",
i,
threadbag[i].started,
- (int)(size_t)result,
- (((int)(size_t)result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED");
+ (int)(size_t)result);
}
failed |= fail;
}
assert(!failed);
+ assert(pthread_barrier_destroy(&go) == 0);
/*
* Success.
diff --git a/pthreads/tests/cancel3.c b/pthreads/tests/cancel3.c
index 5020648a6..742cbc4ff 100644
--- a/pthreads/tests/cancel3.c
+++ b/pthreads/tests/cancel3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -33,7 +34,7 @@
*
* --------------------------------------------------------------------------
*
- * Test Synopsis: Test asynchronous cancelation (alertable or non-alertable).
+ * Test Synopsis: Test asynchronous cancellation (alertable or non-alertable).
*
* Test Method (Validation or Falsification):
* -
@@ -111,7 +112,7 @@ mythread (void *arg)
/*
* We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep (100);
@@ -137,7 +138,7 @@ main ()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep (NUMTHREADS * 100);
@@ -176,9 +177,9 @@ main ()
void* result = (void*)0;
/*
- * The thread does not contain any cancelation points, so
+ * The thread does not contain any cancellation points, so
* a return value of PTHREAD_CANCELED confirms that async
- * cancelation succeeded.
+ * cancellation succeeded.
*/
assert (pthread_join (t[i], &result) == 0);
diff --git a/pthreads/tests/cancel4.c b/pthreads/tests/cancel4.c
index 893f33b12..4267f1728 100644
--- a/pthreads/tests/cancel4.c
+++ b/pthreads/tests/cancel4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -33,8 +34,8 @@
*
* --------------------------------------------------------------------------
*
- * Test Synopsis: Test cancelation does not occur in deferred
- * cancelation threads with no cancelation points.
+ * Test Synopsis: Test cancellation does not occur in deferred
+ * cancellation threads with no cancellation points.
*
* Test Method (Validation or Falsification):
* -
@@ -113,7 +114,7 @@ mythread(void * arg)
/*
* We wait up to 2 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (bag->count = 0; bag->count < 20; bag->count++)
Sleep(100);
@@ -138,7 +139,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
@@ -176,9 +177,9 @@ main()
void* result = (void*)0;
/*
- * The thread does not contain any cancelation points, so
+ * The thread does not contain any cancellation points, so
* a return value of PTHREAD_CANCELED indicates that async
- * cancelation occurred.
+ * cancellation occurred.
*/
assert(pthread_join(t[i], &result) == 0);
diff --git a/pthreads/tests/cancel5.c b/pthreads/tests/cancel5.c
index 6c3951634..e78cf08c2 100644
--- a/pthreads/tests/cancel5.c
+++ b/pthreads/tests/cancel5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -111,7 +112,7 @@ mythread (void *arg)
/*
* We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep (100);
@@ -135,7 +136,7 @@ main ()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep (500);
@@ -174,9 +175,9 @@ main ()
void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
/*
- * The thread does not contain any cancelation points, so
+ * The thread does not contain any cancellation points, so
* a return value of PTHREAD_CANCELED confirms that async
- * cancelation succeeded.
+ * cancellation succeeded.
*/
assert (pthread_join (t[i], &result) == 0);
diff --git a/pthreads/tests/cancel6a.c b/pthreads/tests/cancel6a.c
index 58063d573..3a81eae6d 100644
--- a/pthreads/tests/cancel6a.c
+++ b/pthreads/tests/cancel6a.c
@@ -24,7 +24,7 @@
*
* --------------------------------------------------------------------------
*
- * Test Synopsis: Test double cancelation - asynchronous.
+ * Test Synopsis: Test double cancellation - asynchronous.
* Second attempt should fail (ESRCH).
*
* Test Method (Validation or Falsification):
@@ -100,7 +100,7 @@ mythread(void * arg)
/*
* We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep(100);
@@ -125,7 +125,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
@@ -164,9 +164,9 @@ main()
void* result = (void*)0;
/*
- * The thread does not contain any cancelation points, so
+ * The thread does not contain any cancellation points, so
* a return value of PTHREAD_CANCELED confirms that async
- * cancelation succeeded.
+ * cancellation succeeded.
*/
assert(pthread_join(t[i], &result) == 0);
diff --git a/pthreads/tests/cancel6d.c b/pthreads/tests/cancel6d.c
index 37f9ca5f3..f94ed5ac8 100644
--- a/pthreads/tests/cancel6d.c
+++ b/pthreads/tests/cancel6d.c
@@ -24,9 +24,9 @@
*
* --------------------------------------------------------------------------
*
- * Test Synopsis: Test double cancelation - deferred.
+ * Test Synopsis: Test double cancellation - deferred.
* Second attempt should succeed (unless the canceled thread has started
- * cancelation already - not tested here).
+ * cancellation already - not tested here).
*
* Test Method (Validation or Falsification):
* -
@@ -101,7 +101,7 @@ mythread(void * arg)
/*
* We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (bag->count = 0; bag->count < 100; bag->count++)
{
@@ -129,7 +129,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
@@ -138,7 +138,7 @@ main()
assert(pthread_cancel(t[i]) == 0);
if (pthread_cancel(t[i]) != 0)
{
- printf("Second cancelation failed but this is expected sometimes.\n");
+ printf("Second cancellation failed but this is expected sometimes.\n");
}
}
diff --git a/pthreads/tests/cancel7.c b/pthreads/tests/cancel7.c
index 5f1390f7b..cdd8b1565 100644
--- a/pthreads/tests/cancel7.c
+++ b/pthreads/tests/cancel7.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -143,7 +144,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
diff --git a/pthreads/tests/cancel8.c b/pthreads/tests/cancel8.c
index 7204d19b1..697593f63 100644
--- a/pthreads/tests/cancel8.c
+++ b/pthreads/tests/cancel8.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -144,7 +145,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
diff --git a/pthreads/tests/cancel9.c b/pthreads/tests/cancel9.c
index b0091614a..8f0f15144 100644
--- a/pthreads/tests/cancel9.c
+++ b/pthreads/tests/cancel9.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -33,7 +34,7 @@
*
* --------------------------------------------------------------------------
*
- * Test Synopsis: Test true asynchronous cancelation with Alert driver.
+ * Test Synopsis: Test true asynchronous cancellation with Alert driver.
*
* Test Method (Validation or Falsification):
* -
@@ -172,7 +173,7 @@ main ()
Sleep (100);
assert (pthread_cancel (t) == 0);
assert (pthread_join (t, &result) == 0);
- assert (result == PTHREAD_CANCELED && "test_sleep" != NULL);
+ assert (result == PTHREAD_CANCELED && "test_sleep");
printf ("Cancel waiting thread.\n");
assert (pthread_create (&t, NULL, test_wait, NULL) == 0);
@@ -188,7 +189,7 @@ main ()
Sleep (100);
assert (pthread_cancel (t) == 0);
assert (pthread_join (t, &result) == 0);
- assert (result == PTHREAD_CANCELED && "test_udp" != NULL);
+ assert (result == PTHREAD_CANCELED && "test_udp");
}
else
{
diff --git a/pthreads/tests/cleanup0.c b/pthreads/tests/cleanup0.c
index d9fbedccc..888640b7f 100644
--- a/pthreads/tests/cleanup0.c
+++ b/pthreads/tests/cleanup0.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -97,7 +98,7 @@ typedef struct {
CRITICAL_SECTION cs;
} sharedInt_t;
-static sharedInt_t pop_count = {0, {0}};
+static sharedInt_t pop_count;
static void
increment_pop_count(void * arg)
@@ -147,6 +148,8 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
+ memset(&pop_count, 0, sizeof(sharedInt_t));
+
InitializeCriticalSection(&pop_count.cs);
assert((t[0] = pthread_self()).p != NULL);
@@ -159,7 +162,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
@@ -193,7 +196,7 @@ main()
assert(pthread_join(t[i], &result) == 0);
- fail = ((int)(size_t)result == (int) PTHREAD_CANCELED);
+ fail = (result == PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cleanup1.c b/pthreads/tests/cleanup1.c
index 30d4940b7..a59d05616 100644
--- a/pthreads/tests/cleanup1.c
+++ b/pthreads/tests/cleanup1.c
@@ -6,26 +6,27 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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.,
@@ -36,22 +37,22 @@
* Test Synopsis: Test cleanup handler executes (when thread is canceled).
*
* Test Method (Validation or Falsification):
- * -
+ * -
*
* Requirements Tested:
* -
*
* Features Tested:
- * -
+ * -
*
* Cases Tested:
- * -
+ * -
*
* Description:
- * -
+ * -
*
* Environment:
- * -
+ * -
*
* Input:
* - None.
@@ -97,7 +98,7 @@ typedef struct {
CRITICAL_SECTION cs;
} sharedInt_t;
-static sharedInt_t pop_count = {0, {0}};
+static sharedInt_t pop_count;
static void
#ifdef __CLEANUP_C
@@ -133,10 +134,10 @@ mythread(void * arg)
#endif
pthread_cleanup_push(increment_pop_count, (void *) &pop_count);
/*
- * We don't have true async cancelation - it relies on the thread
+ * We don't have true async cancellation - it relies on the thread
* at least re-entering the run state at some point.
* We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep(100);
@@ -156,6 +157,8 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
+ memset(&pop_count, 0, sizeof(sharedInt_t));
+
InitializeCriticalSection(&pop_count.cs);
assert((t[0] = pthread_self()).p != NULL);
@@ -168,7 +171,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
@@ -188,10 +191,10 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
if (!threadbag[i].started)
- {
- failed |= !threadbag[i].started;
- fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started);
- }
+ {
+ failed |= !threadbag[i].started;
+ fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started);
+ }
}
assert(!failed);
@@ -207,7 +210,7 @@ main()
assert(pthread_join(t[i], &result) == 0);
- fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cleanup2.c b/pthreads/tests/cleanup2.c
index 67037c255..52a804e6a 100644
--- a/pthreads/tests/cleanup2.c
+++ b/pthreads/tests/cleanup2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -97,7 +98,7 @@ typedef struct {
CRITICAL_SECTION cs;
} sharedInt_t;
-static sharedInt_t pop_count = {0, {0}};
+static sharedInt_t pop_count;
static void
increment_pop_count(void * arg)
@@ -141,6 +142,8 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
+ memset(&pop_count, 0, sizeof(sharedInt_t));
+
InitializeCriticalSection(&pop_count.cs);
assert((t[0] = pthread_self()).p != NULL);
@@ -153,7 +156,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(1000);
diff --git a/pthreads/tests/cleanup3.c b/pthreads/tests/cleanup3.c
index 62317b3b0..7d6a4b96a 100644
--- a/pthreads/tests/cleanup3.c
+++ b/pthreads/tests/cleanup3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -98,7 +99,7 @@ typedef struct {
CRITICAL_SECTION cs;
} sharedInt_t;
-static sharedInt_t pop_count = {0, {0}};
+static sharedInt_t pop_count;
static void
increment_pop_count(void * arg)
@@ -146,6 +147,8 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
+ memset(&pop_count, 0, sizeof(sharedInt_t));
+
InitializeCriticalSection(&pop_count.cs);
assert((t[0] = pthread_self()).p != NULL);
@@ -158,7 +161,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(1000);
diff --git a/pthreads/tests/common.mk b/pthreads/tests/common.mk
new file mode 100755
index 000000000..06a21be38
--- /dev/null
+++ b/pthreads/tests/common.mk
@@ -0,0 +1,53 @@
+#
+# Common elements to all makefiles
+#
+
+ALL_KNOWN_TESTS = \
+ affinity1 affinity2 affinity3 affinity4 affinity5 \
+ barrier1 barrier2 barrier3 barrier4 barrier5 barrier6 \
+ cancel1 cancel2 cancel3 cancel4 cancel5 cancel6a cancel6d \
+ cancel7 cancel8 cancel9 \
+ cleanup0 cleanup1 cleanup2 cleanup3 \
+ condvar1 condvar1_1 condvar1_2 condvar2 condvar2_1 \
+ condvar3 condvar3_1 condvar3_2 condvar3_3 \
+ condvar4 condvar5 condvar6 \
+ condvar7 condvar8 condvar9 \
+ count1 \
+ context1 \
+ create1 create2 create3 \
+ delay1 delay2 \
+ detach1 \
+ equal1 \
+ errno1 \
+ exception1 exception2 exception3_0 exception3 \
+ exit1 exit2 exit3 exit4 exit5 \
+ eyal1 \
+ join0 join1 join2 join3 join4 \
+ kill1 \
+ mutex1 mutex1n mutex1e mutex1r \
+ mutex2 mutex2r mutex2e mutex3 mutex3r mutex3e \
+ mutex4 mutex5 mutex6 mutex6n mutex6e mutex6r \
+ mutex6s mutex6es mutex6rs \
+ mutex7 mutex7n mutex7e mutex7r \
+ mutex8 mutex8n mutex8e mutex8r \
+ once1 once2 once3 once4 \
+ priority1 priority2 inherit1 \
+ reuse1 reuse2 \
+ robust1 robust2 robust3 robust4 robust5 \
+ rwlock1 rwlock2 rwlock3 rwlock4 \
+ rwlock2_t rwlock3_t rwlock4_t rwlock5_t rwlock6_t rwlock6_t2 \
+ rwlock5 rwlock6 rwlock7 rwlock8 \
+ self1 self2 \
+ semaphore1 semaphore2 semaphore3 \
+ semaphore4 semaphore4t semaphore5 \
+ sequence1 \
+ sizes \
+ spin1 spin2 spin3 spin4 \
+ stress1 \
+ tsd1 tsd2 \
+ valid1 valid2
+
+TESTS = $(ALL_KNOWN_TESTS)
+
+BENCHTESTS = \
+ benchtest1 benchtest2 benchtest3 benchtest4 benchtest5
diff --git a/pthreads/tests/condvar1.c b/pthreads/tests/condvar1.c
index 380ab1aff..303a87b87 100644
--- a/pthreads/tests/condvar1.c
+++ b/pthreads/tests/condvar1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar1_1.c b/pthreads/tests/condvar1_1.c
index a05e113b9..565697e5d 100644
--- a/pthreads/tests/condvar1_1.c
+++ b/pthreads/tests/condvar1_1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar1_2.c b/pthreads/tests/condvar1_2.c
index 3d961f06d..61185518a 100644
--- a/pthreads/tests/condvar1_2.c
+++ b/pthreads/tests/condvar1_2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar2.c b/pthreads/tests/condvar2.c
index 6e2fa52d2..452b22bea 100644
--- a/pthreads/tests/condvar2.c
+++ b/pthreads/tests/condvar2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -113,10 +114,10 @@ main()
if (result != 0)
{
fprintf(stderr, "Result = %s\n", error_string[result]);
- fprintf(stderr, "\tWaitersBlocked = %ld\n", cv->nWaitersBlocked);
- fprintf(stderr, "\tWaitersGone = %ld\n", cv->nWaitersGone);
- fprintf(stderr, "\tWaitersToUnblock = %ld\n", cv->nWaitersToUnblock);
- fflush(stderr);
+ fprintf(stderr, "\tWaitersBlocked = %ld\n", cv->nWaitersBlocked);
+ fprintf(stderr, "\tWaitersGone = %ld\n", cv->nWaitersGone);
+ fprintf(stderr, "\tWaitersToUnblock = %ld\n", cv->nWaitersToUnblock);
+ fflush(stderr);
}
assert(result == 0);
}
diff --git a/pthreads/tests/condvar2_1.c b/pthreads/tests/condvar2_1.c
index 3486d2110..dc3675566 100644
--- a/pthreads/tests/condvar2_1.c
+++ b/pthreads/tests/condvar2_1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar3.c b/pthreads/tests/condvar3.c
index 056334b37..2fed04143 100644
--- a/pthreads/tests/condvar3.c
+++ b/pthreads/tests/condvar3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar3_1.c b/pthreads/tests/condvar3_1.c
index 33baeb14d..79638fa75 100644
--- a/pthreads/tests/condvar3_1.c
+++ b/pthreads/tests/condvar3_1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar3_2.c b/pthreads/tests/condvar3_2.c
index 4c3580152..0cb332ced 100644
--- a/pthreads/tests/condvar3_2.c
+++ b/pthreads/tests/condvar3_2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar3_3.c b/pthreads/tests/condvar3_3.c
index f842440a1..7a5fc651a 100644
--- a/pthreads/tests/condvar3_3.c
+++ b/pthreads/tests/condvar3_3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar4.c b/pthreads/tests/condvar4.c
index 3f6879b0a..f69e0a97e 100644
--- a/pthreads/tests/condvar4.c
+++ b/pthreads/tests/condvar4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar5.c b/pthreads/tests/condvar5.c
index 73083a55e..8d678d3a2 100644
--- a/pthreads/tests/condvar5.c
+++ b/pthreads/tests/condvar5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/condvar6.c b/pthreads/tests/condvar6.c
index 9d0b75d81..fbf0c8711 100644
--- a/pthreads/tests/condvar6.c
+++ b/pthreads/tests/condvar6.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -176,7 +177,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
assert(pthread_mutex_unlock(&start_flag) == 0);
diff --git a/pthreads/tests/condvar7.c b/pthreads/tests/condvar7.c
index 0647e7d91..d0a1e951d 100644
--- a/pthreads/tests/condvar7.c
+++ b/pthreads/tests/condvar7.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -34,7 +35,7 @@
* --------------------------------------------------------------------------
*
* Test Synopsis:
- * - Test pthread_cond_broadcast with thread cancelation.
+ * - Test pthread_cond_broadcast with thread cancellation.
*
* Test Method (Validation or Falsification):
* - Validation
@@ -186,7 +187,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
assert(pthread_mutex_unlock(&start_flag) == 0);
diff --git a/pthreads/tests/condvar8.c b/pthreads/tests/condvar8.c
index 7c2579d98..a05ccb59c 100644
--- a/pthreads/tests/condvar8.c
+++ b/pthreads/tests/condvar8.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -189,7 +190,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
cvthing.shared = 0;
diff --git a/pthreads/tests/condvar9.c b/pthreads/tests/condvar9.c
index 62d044bf8..910d37b27 100644
--- a/pthreads/tests/condvar9.c
+++ b/pthreads/tests/condvar9.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -34,7 +35,7 @@
* --------------------------------------------------------------------------
*
* Test Synopsis:
- * - Test multiple pthread_cond_broadcasts with thread cancelation.
+ * - Test multiple pthread_cond_broadcasts with thread cancellation.
*
* Test Method (Validation or Falsification):
* - Validation
@@ -128,7 +129,7 @@ mythread(void * arg)
assert(pthread_mutex_lock(&cvthing.lock) == 0);
/*
- * pthread_cond_timedwait is a cancelation point and we're
+ * pthread_cond_timedwait is a cancellation point and we're
* going to cancel some threads deliberately.
*/
#ifdef _MSC_VER
@@ -199,7 +200,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
cvthing.shared = 0;
diff --git a/pthreads/tests/context1.c b/pthreads/tests/context1.c
index db38ec3a1..284d89f70 100644
--- a/pthreads/tests/context1.c
+++ b/pthreads/tests/context1.c
@@ -1,142 +1,142 @@
-/*
- * File: context1.c
- *
- *
- * --------------------------------------------------------------------------
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 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 Synopsis: Test context switching method.
- *
- * Test Method (Validation or Falsification):
- * -
- *
- * Requirements Tested:
- * -
- *
- * Features Tested:
- * -
- *
- * Cases Tested:
- * -
- *
- * Description:
- * -
- *
- * Environment:
- * -
- *
- * Input:
- * - None.
- *
- * Output:
- * - File name, Line number, and failed expression on failure.
- * - No output on success.
- *
- * Assumptions:
- * - pthread_create
- * pthread_exit
- *
- * Pass Criteria:
- * - Process returns zero exit status.
- *
- * Fail Criteria:
- * - Process returns non-zero exit status.
- */
-
-#define _WIN32_WINNT 0x400
-
-#include "test.h"
-#include "../implement.h"
-#include "../context.h"
-
-static int washere = 0;
-
-static void * func(void * arg)
-{
- washere = 1;
-
- Sleep(1000);
-
- return 0;
-}
-
-static void
-anotherEnding ()
-{
- /*
- * Switched context
- */
- washere++;
-
- pthread_exit(0);
-}
-
-int
-main()
-{
- pthread_t t;
- HANDLE hThread;
-
- assert(pthread_create(&t, NULL, func, NULL) == 0);
-
- hThread = ((ptw32_thread_t *)t.p)->threadH;
-
- Sleep(500);
-
- SuspendThread(hThread);
-
- if (WaitForSingleObject(hThread, 0) == WAIT_TIMEOUT)
- {
- /*
- * Ok, thread did not exit before we got to it.
- */
- CONTEXT context;
-
- context.ContextFlags = CONTEXT_CONTROL;
-
- GetThreadContext(hThread, &context);
- PTW32_PROGCTR (context) = (DWORD_PTR) anotherEnding;
- SetThreadContext(hThread, &context);
- ResumeThread(hThread);
- }
- else
- {
- printf("Exited early\n");
- fflush(stdout);
- }
-
- Sleep(1000);
-
- assert(washere == 2);
-
- return 0;
-}
-
+/*
+ * File: context1.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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 Synopsis: Test context switching method.
+ *
+ * Test Method (Validation or Falsification):
+ * -
+ *
+ * Requirements Tested:
+ * -
+ *
+ * Features Tested:
+ * -
+ *
+ * Cases Tested:
+ * -
+ *
+ * Description:
+ * -
+ *
+ * Environment:
+ * -
+ *
+ * Input:
+ * - None.
+ *
+ * Output:
+ * - File name, Line number, and failed expression on failure.
+ * - No output on success.
+ *
+ * Assumptions:
+ * - pthread_create
+ * pthread_exit
+ *
+ * Pass Criteria:
+ * - Process returns zero exit status.
+ *
+ * Fail Criteria:
+ * - Process returns non-zero exit status.
+ */
+
+#define _WIN32_WINNT 0x400
+
+#include "test.h"
+#include "../implement.h"
+#include "../context.h"
+
+static int washere = 0;
+
+static void * func(void * arg)
+{
+ washere = 1;
+
+ Sleep(1000);
+
+ return 0;
+}
+
+static void
+anotherEnding ()
+{
+ /*
+ * Switched context
+ */
+ washere++;
+ pthread_exit(0);
+}
+
+int
+main()
+{
+ pthread_t t;
+ HANDLE hThread;
+
+ assert(pthread_create(&t, NULL, func, NULL) == 0);
+
+ hThread = ((ptw32_thread_t *)t.p)->threadH;
+
+ Sleep(500);
+
+ SuspendThread(hThread);
+
+ if (WaitForSingleObject(hThread, 0) == WAIT_TIMEOUT)
+ {
+ /*
+ * Ok, thread did not exit before we got to it.
+ */
+ CONTEXT context;
+
+ context.ContextFlags = CONTEXT_CONTROL;
+
+ GetThreadContext(hThread, &context);
+ PTW32_PROGCTR (context) = (DWORD_PTR) anotherEnding;
+ SetThreadContext(hThread, &context);
+ ResumeThread(hThread);
+ }
+ else
+ {
+ printf("Exited early\n");
+ fflush(stdout);
+ }
+
+ Sleep(1000);
+
+ assert(washere == 2);
+
+ return 0;
+}
+
diff --git a/pthreads/tests/context2.c b/pthreads/tests/context2.c
new file mode 100755
index 000000000..154948a4f
--- /dev/null
+++ b/pthreads/tests/context2.c
@@ -0,0 +1,157 @@
+/*
+ * File: context2.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2005 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 Synopsis: Test context switching method.
+ *
+ * Test Method (Validation or Falsification):
+ * -
+ *
+ * Requirements Tested:
+ * -
+ *
+ * Features Tested:
+ * -
+ *
+ * Cases Tested:
+ * -
+ *
+ * Description:
+ * -
+ *
+ * Environment:
+ * -
+ *
+ * Input:
+ * - None.
+ *
+ * Output:
+ * - File name, Line number, and failed expression on failure.
+ * - No output on success.
+ *
+ * Assumptions:
+ * - pthread_create
+ * pthread_exit
+ *
+ * Pass Criteria:
+ * - Process returns zero exit status.
+ *
+ * Fail Criteria:
+ * - Process returns non-zero exit status.
+ */
+
+#define _WIN32_WINNT 0x400
+
+#include "test.h"
+#include "../implement.h"
+#include "../context.h"
+
+static int washere = 0;
+static volatile size_t tree_counter = 0;
+
+#ifdef _MSC_VER
+# pragma inline_depth(0)
+# pragma optimize("g", off)
+#endif
+
+static size_t tree(size_t depth)
+{
+ if (! depth--)
+ return tree_counter++;
+
+ return tree(depth) + tree(depth);
+}
+
+static void * func(void * arg)
+{
+ washere = 1;
+
+ return (void *) tree(64);
+}
+
+static void
+anotherEnding ()
+{
+ /*
+ * Switched context
+ */
+ washere++;
+ pthread_exit(0);
+}
+
+#ifdef _MSC_VER
+# pragma inline_depth()
+# pragma optimize("", on)
+#endif
+
+int
+main()
+{
+ pthread_t t;
+ HANDLE hThread;
+
+ assert(pthread_create(&t, NULL, func, NULL) == 0);
+
+ hThread = ((ptw32_thread_t *)t.p)->threadH;
+
+ Sleep(500);
+
+ SuspendThread(hThread);
+
+ if (WaitForSingleObject(hThread, 0) == WAIT_TIMEOUT)
+ {
+ /*
+ * Ok, thread did not exit before we got to it.
+ */
+ CONTEXT context;
+
+ context.ContextFlags = CONTEXT_CONTROL;
+
+ GetThreadContext(hThread, &context);
+ PTW32_PROGCTR (context) = (DWORD_PTR) anotherEnding;
+ SetThreadContext(hThread, &context);
+ ResumeThread(hThread);
+ }
+ else
+ {
+ printf("Exited early\n");
+ fflush(stdout);
+ }
+
+ Sleep(1000);
+
+ assert(washere == 2);
+
+ return 0;
+}
diff --git a/pthreads/tests/count1.c b/pthreads/tests/count1.c
index c2386b0e9..c639fd270 100644
--- a/pthreads/tests/count1.c
+++ b/pthreads/tests/count1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/create1.c b/pthreads/tests/create1.c
index 8c630cb93..63b1bf6eb 100644
--- a/pthreads/tests/create1.c
+++ b/pthreads/tests/create1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/create2.c b/pthreads/tests/create2.c
index 9b4e86480..9e56d9d40 100644
--- a/pthreads/tests/create2.c
+++ b/pthreads/tests/create2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/create3.c b/pthreads/tests/create3.c
new file mode 100755
index 000000000..5063d0ba7
--- /dev/null
+++ b/pthreads/tests/create3.c
@@ -0,0 +1,110 @@
+/*
+ * File: create3.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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 Synopsis:
+ * - Test passing arg to thread function.
+ *
+ * Test Method (Validation or Falsification):
+ * - Statistical, not absolute (depends on sample size).
+ *
+ * Requirements Tested:
+ * -
+ *
+ * Features Tested:
+ * -
+ *
+ * Cases Tested:
+ * -
+ *
+ * Description:
+ * -
+ *
+ * Environment:
+ * -
+ *
+ * Input:
+ * - None.
+ *
+ * Output:
+ * - File name, Line number, and failed expression on failure.
+ * - No output on success.
+ *
+ * Assumptions:
+ * -
+ *
+ * Pass Criteria:
+ * - Process returns zero exit status.
+ *
+ * Fail Criteria:
+ * - Process returns non-zero exit status.
+ */
+
+#include "test.h"
+
+enum {
+ NUMTHREADS = 10000
+};
+
+static int washere = 0;
+
+void * func(void * arg)
+{
+ washere = (int)(size_t)arg;
+ return (void *) 0;
+}
+
+int
+main()
+{
+ pthread_t t;
+ pthread_attr_t attr;
+ void * result = NULL;
+ int i;
+
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+
+ for (i = 0; i < NUMTHREADS; i++)
+ {
+ washere = 0;
+ assert(pthread_create(&t, &attr, func, (void *)(size_t)1) == 0);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 0);
+ assert(washere == 1);
+ }
+
+ return 0;
+}
diff --git a/pthreads/tests/delay1.c b/pthreads/tests/delay1.c
index 83becd890..9c5293e87 100644
--- a/pthreads/tests/delay1.c
+++ b/pthreads/tests/delay1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/delay2.c b/pthreads/tests/delay2.c
index 071b837f1..5ff6c1deb 100644
--- a/pthreads/tests/delay2.c
+++ b/pthreads/tests/delay2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/detach1.c b/pthreads/tests/detach1.c
index 89756c7ad..4eb8cb73d 100644
--- a/pthreads/tests/detach1.c
+++ b/pthreads/tests/detach1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/equal1.c b/pthreads/tests/equal1.c
index 8932bb2aa..2dfa79425 100644
--- a/pthreads/tests/equal1.c
+++ b/pthreads/tests/equal1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/errno1.c b/pthreads/tests/errno1.c
index 70ce92802..14e8150a9 100644
--- a/pthreads/tests/errno1.c
+++ b/pthreads/tests/errno1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -135,7 +136,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(2000);
pthread_mutex_unlock(&stop_here);
diff --git a/pthreads/tests/exception1.c b/pthreads/tests/exception1.c
index 62a5a63cb..5470ad993 100644
--- a/pthreads/tests/exception1.c
+++ b/pthreads/tests/exception1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -153,7 +154,7 @@ canceledThread(void * arg)
{
/*
* We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (count = 0; count < 100; count++)
Sleep(100);
@@ -168,7 +169,7 @@ canceledThread(void * arg)
{
/*
* We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
+ * for a cancellation to be applied to us.
*/
for (count = 0; count < 100; count++)
Sleep(100);
@@ -205,7 +206,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(1000);
diff --git a/pthreads/tests/exception2.c b/pthreads/tests/exception2.c
index faf677d9b..fffe2b558 100644
--- a/pthreads/tests/exception2.c
+++ b/pthreads/tests/exception2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -125,10 +126,21 @@ main(int argc, char* argv[])
printf("You should see an \"abnormal termination\" message\n");
fflush(stdout);
+
result = system("exception2.exe die");
- exit(0);
+
+ printf("\"exception2.exe die\" returned status %d\n", result);
+
+ /*
+ * result should be 0, 1 or 3 depending on build settings
+ */
+ exit((result == 0 || result == 1 || result == 3) ? 0 : 1);
}
+#if defined(NO_ERROR_DIALOGS)
+ SetErrorMode(SEM_NOGPFAULTERRORBOX);
+#endif
+
assert((mt = pthread_self()).p != NULL);
for (i = 0; i < NUMTHREADS; i++)
@@ -136,7 +148,7 @@ main(int argc, char* argv[])
assert(pthread_create(&et[i], NULL, exceptionedThread, NULL) == 0);
}
- Sleep(1000);
+ Sleep(100);
/*
* Success.
diff --git a/pthreads/tests/exception3.c b/pthreads/tests/exception3.c
index 65bcdbef3..3b9ec6fd9 100644
--- a/pthreads/tests/exception3.c
+++ b/pthreads/tests/exception3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -73,7 +74,13 @@
#include "test.h"
-#if defined(__cplusplus)
+/*
+ * Note: Due to a buggy C++ runtime in Visual Studio 2005, when we are
+ * built with /MD and an unhandled exception occurs, the runtime does not
+ * properly call the terminate handler specified by set_terminate().
+ */
+#if defined(__cplusplus) \
+ && !(defined(_MSC_VER) && _MSC_VER == 1400 && defined(_DLL) && !defined(_DEBUG))
#if defined(_MSC_VER)
# include <eh.h>
@@ -90,7 +97,7 @@
* Create NUMTHREADS threads in addition to the Main thread.
*/
enum {
- NUMTHREADS = 1
+ NUMTHREADS = 10
};
int caught = 0;
@@ -125,12 +132,24 @@ terminateFunction ()
exit(0);
}
+void
+wrongTerminateFunction ()
+{
+ fputs("This is not the termination routine that should have been called!\n", stderr);
+ exit(1);
+}
+
void *
exceptionedThread(void * arg)
{
int dummy = 0x1;
- (void) set_terminate(&terminateFunction);
+#if defined(PTW32_USES_SEPARATE_CRT) && (defined(__CLEANUP_CXX) || defined(__CLEANUP_SEH))
+ pthread_win32_set_terminate_np(&terminateFunction);
+ set_terminate(&wrongTerminateFunction);
+#else
+ set_terminate(&terminateFunction);
+#endif
throw dummy;
@@ -159,14 +178,12 @@ main()
assert(pthread_create(&et[i], NULL, exceptionedThread, NULL) == 0);
}
- Sleep(NUMTHREADS * 100);
-
- assert(caught == NUMTHREADS);
+ Sleep(NUMTHREADS * 10);
/*
- * Success.
+ * Fail. Should never be reached.
*/
- return 0;
+ return 1;
}
#else /* defined(__cplusplus) */
diff --git a/pthreads/tests/exception3_0.c b/pthreads/tests/exception3_0.c
new file mode 100755
index 000000000..bc06bf335
--- /dev/null
+++ b/pthreads/tests/exception3_0.c
@@ -0,0 +1,187 @@
+/*
+ * File: exception3.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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 Synopsis: Test running of user supplied terminate() function.
+ *
+ * Test Method (Validation or Falsification):
+ * -
+ *
+ * Requirements Tested:
+ * -
+ *
+ * Features Tested:
+ * -
+ *
+ * Cases Tested:
+ * -
+ *
+ * Description:
+ * -
+ *
+ * Environment:
+ * -
+ *
+ * Input:
+ * - None.
+ *
+ * Output:
+ * - File name, Line number, and failed expression on failure.
+ * - No output on success.
+ *
+ * Assumptions:
+ * - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
+ * pthread_testcancel, pthread_cancel
+ *
+ * Pass Criteria:
+ * - Process returns zero exit status.
+ *
+ * Fail Criteria:
+ * - Process returns non-zero exit status.
+ */
+
+#include "test.h"
+
+/*
+ * Note: Due to a buggy C++ runtime in Visual Studio 2005, when we are
+ * built with /MD and an unhandled exception occurs, the runtime does not
+ * properly call the terminate handler specified by set_terminate().
+ */
+#if defined(__cplusplus) \
+ && !(defined(_MSC_VER) && _MSC_VER == 1400 && defined(_DLL) && !defined(_DEBUG))
+
+#if defined(_MSC_VER)
+# include <eh.h>
+#else
+# if defined(__GNUC__) && __GNUC__ < 3
+# include <new.h>
+# else
+# include <new>
+ using std::set_terminate;
+# endif
+#endif
+
+/*
+ * Create NUMTHREADS threads in addition to the Main thread.
+ */
+enum {
+ NUMTHREADS = 10
+};
+
+int caught = 0;
+CRITICAL_SECTION caughtLock;
+
+void
+terminateFunction ()
+{
+ EnterCriticalSection(&caughtLock);
+ caught++;
+#if 0
+ {
+ FILE * fp = fopen("pthread.log", "a");
+ fprintf(fp, "Caught = %d\n", caught);
+ fclose(fp);
+ }
+#endif
+ LeaveCriticalSection(&caughtLock);
+
+ /*
+ * Notes from the MSVC++ manual:
+ * 1) A term_func() should call exit(), otherwise
+ * abort() will be called on return to the caller.
+ * abort() raises SIGABRT. The default signal handler
+ * for all signals terminates the calling program with
+ * exit code 3.
+ * 2) A term_func() must not throw an exception. Dev: Therefore
+ * term_func() should not call pthread_exit() if an
+ * exception-using version of pthreads-win32 library
+ * is being used (i.e. either pthreadVCE or pthreadVSE).
+ */
+ exit(0);
+}
+
+void *
+exceptionedThread(void * arg)
+{
+ int dummy = 0x1;
+
+ set_terminate(&terminateFunction);
+ assert(set_terminate(&terminateFunction) == &terminateFunction);
+
+ throw dummy;
+
+ return (void *) 2;
+}
+
+int
+main()
+{
+ int i;
+ DWORD et[NUMTHREADS];
+
+ InitializeCriticalSection(&caughtLock);
+
+ for (i = 0; i < NUMTHREADS; i++)
+ {
+ CreateThread(NULL, //Choose default security
+ 0, //Default stack size
+ (LPTHREAD_START_ROUTINE)&exceptionedThread, //Routine to execute
+ NULL, //Thread parameter
+ 0, //Immediately run the thread
+ &et[i] //Thread Id
+ );
+ }
+
+ Sleep(NUMTHREADS * 10);
+
+ DeleteCriticalSection(&caughtLock);
+ /*
+ * Fail. Should never be reached.
+ */
+ return 1;
+}
+
+#else /* defined(__cplusplus) */
+
+#include <stdio.h>
+
+int
+main()
+{
+ fprintf(stderr, "Test N/A for this compiler environment.\n");
+ return 0;
+}
+
+#endif /* defined(__cplusplus) */
diff --git a/pthreads/tests/exit1.c b/pthreads/tests/exit1.c
index 38f218211..352942452 100644
--- a/pthreads/tests/exit1.c
+++ b/pthreads/tests/exit1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -45,6 +46,5 @@ main(int argc, char * argv[])
pthread_exit((void *) 0);
/* Not reached */
- assert(0);
- return 0;
+ return 1;
}
diff --git a/pthreads/tests/exit2.c b/pthreads/tests/exit2.c
index b9f785edf..7438c865e 100644
--- a/pthreads/tests/exit2.c
+++ b/pthreads/tests/exit2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/exit3.c b/pthreads/tests/exit3.c
index 18859e4ee..6c01a0261 100644
--- a/pthreads/tests/exit3.c
+++ b/pthreads/tests/exit3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/exit4.c b/pthreads/tests/exit4.c
index 06dd8b1ee..e41383895 100644
--- a/pthreads/tests/exit4.c
+++ b/pthreads/tests/exit4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -136,7 +137,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
diff --git a/pthreads/tests/exit5.c b/pthreads/tests/exit5.c
index ac98f996c..c9ecf44e4 100644
--- a/pthreads/tests/exit5.c
+++ b/pthreads/tests/exit5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -140,7 +141,7 @@ main()
}
/*
- * Code to control or munipulate child threads should probably go here.
+ * Code to control or manipulate child threads should probably go here.
*/
Sleep(500);
diff --git a/pthreads/tests/eyal1.c b/pthreads/tests/eyal1.c
index 72b5697e9..5da95ff5d 100644
--- a/pthreads/tests/eyal1.c
+++ b/pthreads/tests/eyal1.c
@@ -5,10 +5,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -142,13 +143,10 @@ waste_time (int n)
static int
do_work_unit (int who, int n)
{
- int i;
static int nchars = 0;
double f = 0.0;
- if (quiet)
- i = 0;
- else {
+ if (!quiet) {
/*
* get lock on stdout
*/
@@ -157,7 +155,7 @@ do_work_unit (int who, int n)
/*
* do our job
*/
- i = printf ("%c", "0123456789abcdefghijklmnopqrstuvwxyz"[who]);
+ (void) printf ("%c", "0123456789abcdefghijklmnopqrstuvwxyz"[who]);
if (!(++nchars % 50))
printf ("\n");
diff --git a/pthreads/tests/inherit1.c b/pthreads/tests/inherit1.c
index 24ceec557..d09cfc773 100644
--- a/pthreads/tests/inherit1.c
+++ b/pthreads/tests/inherit1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/join0.c b/pthreads/tests/join0.c
index d888e9d6b..f5c040eb5 100644
--- a/pthreads/tests/join0.c
+++ b/pthreads/tests/join0.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/join1.c b/pthreads/tests/join1.c
index 337af832d..a04127915 100644
--- a/pthreads/tests/join1.c
+++ b/pthreads/tests/join1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/join2.c b/pthreads/tests/join2.c
index b3b85ee81..8864f221a 100644
--- a/pthreads/tests/join2.c
+++ b/pthreads/tests/join2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/join3.c b/pthreads/tests/join3.c
index 44380ace3..35368667d 100644
--- a/pthreads/tests/join3.c
+++ b/pthreads/tests/join3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/join4.c b/pthreads/tests/join4.c
new file mode 100755
index 000000000..cbe96d29a
--- /dev/null
+++ b/pthreads/tests/join4.c
@@ -0,0 +1,87 @@
+/*
+ * Test for pthread_timedjoin_np() timing out.
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Depends on API functions: pthread_create().
+ */
+
+#include "test.h"
+
+void *
+func(void * arg)
+{
+ Sleep(1200);
+ return arg;
+}
+
+int
+main(int argc, char * argv[])
+{
+ pthread_t id;
+ struct timespec abstime;
+ void* result = (void*)-1;
+ PTW32_STRUCT_TIMEB currSysTime;
+ const DWORD NANOSEC_PER_MILLISEC = 1000000;
+
+ assert(pthread_create(&id, NULL, func, (void *)(size_t)999) == 0);
+
+ /*
+ * Let thread start before we attempt to join it.
+ */
+ Sleep(100);
+
+ PTW32_FTIME(&currSysTime);
+
+ abstime.tv_sec = (long)currSysTime.time;
+ abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
+
+ /* Test for pthread_timedjoin_np timeout */
+ abstime.tv_sec += 1;
+ assert(pthread_timedjoin_np(id, &result, &abstime) == ETIMEDOUT);
+ assert((int)(size_t)result == -1);
+
+ /* Test for pthread_tryjoin_np behaviour before thread has exited */
+ assert(pthread_tryjoin_np(id, &result) == EBUSY);
+ assert((int)(size_t)result == -1);
+
+ Sleep(500);
+
+ /* Test for pthread_tryjoin_np behaviour after thread has exited */
+ assert(pthread_tryjoin_np(id, &result) == 0);
+ assert((int)(size_t)result == 999);
+
+ /* Success. */
+ return 0;
+}
diff --git a/pthreads/tests/kill1.c b/pthreads/tests/kill1.c
index fd1eaee2b..84ca3c00b 100644
--- a/pthreads/tests/kill1.c
+++ b/pthreads/tests/kill1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex1.c b/pthreads/tests/mutex1.c
index 918c90330..6d9beaf83 100644
--- a/pthreads/tests/mutex1.c
+++ b/pthreads/tests/mutex1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex1e.c b/pthreads/tests/mutex1e.c
index d32adb3a1..9d0a32eca 100644
--- a/pthreads/tests/mutex1e.c
+++ b/pthreads/tests/mutex1e.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex1n.c b/pthreads/tests/mutex1n.c
index fcfc1347c..7e306cfa4 100644
--- a/pthreads/tests/mutex1n.c
+++ b/pthreads/tests/mutex1n.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex1r.c b/pthreads/tests/mutex1r.c
index 15083f27a..fb2de7eab 100644
--- a/pthreads/tests/mutex1r.c
+++ b/pthreads/tests/mutex1r.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex2.c b/pthreads/tests/mutex2.c
index 377468e90..8bd490f32 100644
--- a/pthreads/tests/mutex2.c
+++ b/pthreads/tests/mutex2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex2e.c b/pthreads/tests/mutex2e.c
index 7df6073d2..dd17ccd8c 100644
--- a/pthreads/tests/mutex2e.c
+++ b/pthreads/tests/mutex2e.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex2r.c b/pthreads/tests/mutex2r.c
index c96e366f1..740d60736 100644
--- a/pthreads/tests/mutex2r.c
+++ b/pthreads/tests/mutex2r.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex3.c b/pthreads/tests/mutex3.c
index bc1429e0b..94ca2daee 100644
--- a/pthreads/tests/mutex3.c
+++ b/pthreads/tests/mutex3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex3e.c b/pthreads/tests/mutex3e.c
index 66cfcb71c..40911fc89 100644
--- a/pthreads/tests/mutex3e.c
+++ b/pthreads/tests/mutex3e.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex3r.c b/pthreads/tests/mutex3r.c
index 8fa7f2547..891692b4d 100644
--- a/pthreads/tests/mutex3r.c
+++ b/pthreads/tests/mutex3r.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex4.c b/pthreads/tests/mutex4.c
index 6d36e0aa1..220c26011 100644
--- a/pthreads/tests/mutex4.c
+++ b/pthreads/tests/mutex4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex5.c b/pthreads/tests/mutex5.c
index a71f9d893..6d1237936 100644
--- a/pthreads/tests/mutex5.c
+++ b/pthreads/tests/mutex5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/mutex6.c b/pthreads/tests/mutex6.c
index 15649fc8d..79a896b8b 100644
--- a/pthreads/tests/mutex6.c
+++ b/pthreads/tests/mutex6.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -86,8 +87,5 @@ main()
assert(lockCount == 2);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex6e.c b/pthreads/tests/mutex6e.c
index 908a51ba1..d6f695466 100644
--- a/pthreads/tests/mutex6e.c
+++ b/pthreads/tests/mutex6e.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -101,9 +102,6 @@ main()
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex6es.c b/pthreads/tests/mutex6es.c
index d4b624959..6fa2424f0 100644
--- a/pthreads/tests/mutex6es.c
+++ b/pthreads/tests/mutex6es.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -86,9 +87,6 @@ main()
assert(pthread_mutex_destroy(&mutex) == 0);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex6n.c b/pthreads/tests/mutex6n.c
index 9cb309c2c..cf3581169 100644
--- a/pthreads/tests/mutex6n.c
+++ b/pthreads/tests/mutex6n.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -91,17 +92,14 @@ main()
assert(lockCount == 1);
- assert(pthread_mutex_unlock(&mutex) == IS_ROBUST?EPERM:0);
+ assert(pthread_mutex_unlock(&mutex) == (IS_ROBUST?EPERM:0));
Sleep (100);
- assert(lockCount == IS_ROBUST?1:2);
+ assert(lockCount == (IS_ROBUST?1:2));
END_MUTEX_STALLED_ROBUST(mxAttr)
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex6r.c b/pthreads/tests/mutex6r.c
index 9d81ad849..41fc6914b 100644
--- a/pthreads/tests/mutex6r.c
+++ b/pthreads/tests/mutex6r.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -100,8 +101,5 @@ main()
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex6rs.c b/pthreads/tests/mutex6rs.c
index 4242fd627..d17566d7c 100644
--- a/pthreads/tests/mutex6rs.c
+++ b/pthreads/tests/mutex6rs.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -85,8 +86,5 @@ main()
assert(pthread_mutex_destroy(&mutex) == 0);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex6s.c b/pthreads/tests/mutex6s.c
index 8b82dc3fa..2b13eba2f 100644
--- a/pthreads/tests/mutex6s.c
+++ b/pthreads/tests/mutex6s.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -86,8 +87,5 @@ main()
assert(lockCount == 2);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex7.c b/pthreads/tests/mutex7.c
index 4137c351d..3110ca778 100644
--- a/pthreads/tests/mutex7.c
+++ b/pthreads/tests/mutex7.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -75,8 +76,5 @@ main()
assert(lockCount == 2);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex7e.c b/pthreads/tests/mutex7e.c
index 80981b3e1..1fc1a15f4 100644
--- a/pthreads/tests/mutex7e.c
+++ b/pthreads/tests/mutex7e.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -100,9 +101,6 @@ main()
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex7n.c b/pthreads/tests/mutex7n.c
index 87ba10a57..e8d280fb6 100644
--- a/pthreads/tests/mutex7n.c
+++ b/pthreads/tests/mutex7n.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -92,9 +93,6 @@ main()
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex7r.c b/pthreads/tests/mutex7r.c
index 4e4ae8a9a..3e0ae135a 100644
--- a/pthreads/tests/mutex7r.c
+++ b/pthreads/tests/mutex7r.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -100,8 +101,5 @@ main()
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
- exit(0);
-
- /* Never reached */
return 0;
}
diff --git a/pthreads/tests/mutex8.c b/pthreads/tests/mutex8.c
index f2636786c..35ce5629c 100644
--- a/pthreads/tests/mutex8.c
+++ b/pthreads/tests/mutex8.c
@@ -35,7 +35,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
static int lockCount = 0;
diff --git a/pthreads/tests/mutex8e.c b/pthreads/tests/mutex8e.c
index a36056673..ec2838f7b 100644
--- a/pthreads/tests/mutex8e.c
+++ b/pthreads/tests/mutex8e.c
@@ -42,7 +42,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
static int lockCount;
diff --git a/pthreads/tests/mutex8n.c b/pthreads/tests/mutex8n.c
index 0c6d97d7f..0fa290ce4 100644
--- a/pthreads/tests/mutex8n.c
+++ b/pthreads/tests/mutex8n.c
@@ -42,7 +42,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
static int lockCount;
diff --git a/pthreads/tests/mutex8r.c b/pthreads/tests/mutex8r.c
index 434b9af8e..1b9f00f03 100644
--- a/pthreads/tests/mutex8r.c
+++ b/pthreads/tests/mutex8r.c
@@ -42,7 +42,6 @@
*/
#include "test.h"
-#include <sys/timeb.h>
static int lockCount;
diff --git a/pthreads/tests/once1.c b/pthreads/tests/once1.c
index daec112d7..3a7f2e8cd 100644
--- a/pthreads/tests/once1.c
+++ b/pthreads/tests/once1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/once2.c b/pthreads/tests/once2.c
index 84e3f4bf6..ffd6bfe10 100644
--- a/pthreads/tests/once2.c
+++ b/pthreads/tests/once2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -54,8 +55,8 @@ typedef struct {
CRITICAL_SECTION cs;
} sharedInt_t;
-static sharedInt_t numOnce = {0, {0}};
-static sharedInt_t numThreads = {0, {0}};
+static sharedInt_t numOnce;
+static sharedInt_t numThreads;
void
myfunc(void)
@@ -83,6 +84,9 @@ main()
pthread_t t[NUM_THREADS][NUM_ONCE];
int i, j;
+ memset(&numOnce, 0, sizeof(sharedInt_t));
+ memset(&numThreads, 0, sizeof(sharedInt_t));
+
InitializeCriticalSection(&numThreads.cs);
InitializeCriticalSection(&numOnce.cs);
@@ -91,7 +95,11 @@ main()
once[j] = o;
for (i = 0; i < NUM_THREADS; i++)
- assert(pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j) == 0);
+ {
+ /* GCC build: create was failing with EAGAIN after 790 threads */
+ while (0 != pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j))
+ sched_yield();
+ }
}
for (j = 0; j < NUM_ONCE; j++)
diff --git a/pthreads/tests/once3.c b/pthreads/tests/once3.c
index ef1229043..6c7728607 100644
--- a/pthreads/tests/once3.c
+++ b/pthreads/tests/once3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -60,8 +61,8 @@ typedef struct {
CRITICAL_SECTION cs;
} sharedInt_t;
-static sharedInt_t numOnce = {0, {0}};
-static sharedInt_t numThreads = {0, {0}};
+static sharedInt_t numOnce;
+static sharedInt_t numThreads;
void
myfunc(void)
@@ -72,7 +73,7 @@ myfunc(void)
LeaveCriticalSection(&numOnce.cs);
/* Simulate slow once routine so that following threads pile up behind it */
Sleep(10);
- /* test for cancelation late so we're sure to have waiters. */
+ /* Test for cancellation late so we're sure to have waiters. */
pthread_testcancel();
}
@@ -81,12 +82,18 @@ mythread(void * arg)
{
/*
* Cancel every thread. These threads are deferred cancelable only, so
- * only the thread performing the once routine (my_func) will see it (there are
- * no other cancelation points here). The result will be that every thread
- * eventually cancels only when it becomes the new 'once' thread.
+ * this thread will see it only when it performs the once routine (my_func).
+ * The result will be that every thread eventually cancels only when it
+ * becomes the new 'once' thread.
*/
assert(pthread_cancel(pthread_self()) == 0);
+ /*
+ * Now we block on the 'once' control.
+ */
assert(pthread_once(&once[(int)(size_t)arg], myfunc) == 0);
+ /*
+ * We should never get to here.
+ */
EnterCriticalSection(&numThreads.cs);
numThreads.i++;
LeaveCriticalSection(&numThreads.cs);
@@ -98,7 +105,16 @@ main()
{
pthread_t t[NUM_THREADS][NUM_ONCE];
int i, j;
+
+#if defined(PTW32_CONFIG_MSVC6) && defined(__CLEANUP_CXX)
+ puts("If this test fails or hangs, rebuild the library with /EHa instead of /EHs.");
+ puts("(This is a known issue with Microsoft VC++6.0.)");
+ fflush(stdout);
+#endif
+ memset(&numOnce, 0, sizeof(sharedInt_t));
+ memset(&numThreads, 0, sizeof(sharedInt_t));
+
InitializeCriticalSection(&numThreads.cs);
InitializeCriticalSection(&numOnce.cs);
@@ -108,7 +124,9 @@ main()
for (i = 0; i < NUM_THREADS; i++)
{
- assert(pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j) == 0);
+ /* GCC build: create was failing with EAGAIN after 790 threads */
+ while (0 != pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j))
+ sched_yield();
}
}
diff --git a/pthreads/tests/once4.c b/pthreads/tests/once4.c
index f5be64486..b708aae69 100644
--- a/pthreads/tests/once4.c
+++ b/pthreads/tests/once4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -58,8 +59,8 @@ typedef struct {
CRITICAL_SECTION cs;
} sharedInt_t;
-static sharedInt_t numOnce = {0, {0}};
-static sharedInt_t numThreads = {0, {0}};
+static sharedInt_t numOnce;
+static sharedInt_t numThreads;
typedef struct {
int threadnum;
@@ -94,7 +95,7 @@ myinitfunc(void)
LeaveCriticalSection(&numOnce.cs);
/* Simulate slow once routine so that following threads pile up behind it */
Sleep(10);
- /* test for cancelation late so we're sure to have waiters. */
+ /* test for cancellation late so we're sure to have waiters. */
pthread_testcancel();
}
@@ -107,7 +108,7 @@ mythread(void * arg)
/*
* Cancel every thread. These threads are deferred cancelable only, so
* only the thread performing the init_routine will see it (there are
- * no other cancelation points here). The result will be that every thread
+ * no other cancellation points here). The result will be that every thread
* eventually cancels only when it becomes the new initter.
*/
pthread_t self = pthread_self();
@@ -139,7 +140,16 @@ main()
{
pthread_t t[NUM_THREADS][NUM_ONCE];
int i, j;
-
+
+#if defined(PTW32_CONFIG_MSVC6) && defined(__CLEANUP_CXX)
+ puts("If this test fails or hangs, rebuild the library with /EHa instead of /EHs.");
+ puts("(This is a known issue with Microsoft VC++6.0.)");
+ fflush(stdout);
+#endif
+
+ memset(&numOnce, 0, sizeof(sharedInt_t));
+ memset(&numThreads, 0, sizeof(sharedInt_t));
+
InitializeCriticalSection(&print_lock);
InitializeCriticalSection(&numThreads.cs);
InitializeCriticalSection(&numOnce.cs);
@@ -166,7 +176,9 @@ main()
bag_t * bag = &threadbag[i][j];
bag->threadnum = i;
bag->oncenum = j;
- assert(pthread_create(&t[i][j], NULL, mythread, (void *) bag) == 0);
+ /* GCC build: create was failing with EAGAIN after 790 threads */
+ while (0 != pthread_create(&t[i][j], NULL, mythread, (void *)bag))
+ sched_yield();
}
}
diff --git a/pthreads/tests/openmp1.c b/pthreads/tests/openmp1.c
index ee36e75c8..b5791e2ea 100644
--- a/pthreads/tests/openmp1.c
+++ b/pthreads/tests/openmp1.c
@@ -28,7 +28,7 @@ void *_thread(void* Id) {
if (Verbose && i%1000==0) {
int tid = omp_get_thread_num();
# pragma omp critical
- printf("thread %d : tid %d handles %d\n",(int)Id,tid,i);
+ printf("thread %d : tid %d handles %d\n",(int)(size_t)Id,tid,i);
}
#endif
@@ -43,9 +43,9 @@ void *_thread(void* Id) {
#ifdef _OPENMP
# pragma omp critical
#endif
- printf("Id %d : %s : %d(should be %d)\n",(int)Id, __FUNCTION__, Sum,ShouldSum);
+ printf("Id %d : %s : %d(should be %d)\n",(int)(size_t)Id, __FUNCTION__, Sum,ShouldSum);
}
- if (Sum == ShouldSum) ThreadOK[(int)Id] = 1;
+ if (Sum == ShouldSum) ThreadOK[(int)(size_t)Id] = 1;
return NULL;
}
@@ -61,7 +61,7 @@ void MainThread() {
int tid = omp_get_thread_num();
# pragma omp critical
printf("Main : tid %d\n",tid);
- _thread((void *)tid);
+ _thread((void *)(size_t)tid);
#endif
}
return;
diff --git a/pthreads/tests/priority1.c b/pthreads/tests/priority1.c
index 40316cc64..d77420f88 100644
--- a/pthreads/tests/priority1.c
+++ b/pthreads/tests/priority1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/priority2.c b/pthreads/tests/priority2.c
index 7d4648f90..c4552e625 100644
--- a/pthreads/tests/priority2.c
+++ b/pthreads/tests/priority2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/reuse1.c b/pthreads/tests/reuse1.c
index 1a7dff0e0..bcf8571ca 100644
--- a/pthreads/tests/reuse1.c
+++ b/pthreads/tests/reuse1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/reuse2.c b/pthreads/tests/reuse2.c
index 362e547d9..93643b90e 100644
--- a/pthreads/tests/reuse2.c
+++ b/pthreads/tests/reuse2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/robust1.c b/pthreads/tests/robust1.c
index 100a8545b..4bb479ac7 100644
--- a/pthreads/tests/robust1.c
+++ b/pthreads/tests/robust1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/robust2.c b/pthreads/tests/robust2.c
index 2b3917a6e..795a17ffa 100644
--- a/pthreads/tests/robust2.c
+++ b/pthreads/tests/robust2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/robust3.c b/pthreads/tests/robust3.c
index cbf99df73..e9d05c7dd 100644
--- a/pthreads/tests/robust3.c
+++ b/pthreads/tests/robust3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/robust4.c b/pthreads/tests/robust4.c
index 136a183bd..35d5b84f8 100644
--- a/pthreads/tests/robust4.c
+++ b/pthreads/tests/robust4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/robust5.c b/pthreads/tests/robust5.c
index c67d12482..82e592e9b 100644
--- a/pthreads/tests/robust5.c
+++ b/pthreads/tests/robust5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/runorder.mk b/pthreads/tests/runorder.mk
new file mode 100755
index 000000000..8eba0e3da
--- /dev/null
+++ b/pthreads/tests/runorder.mk
@@ -0,0 +1,149 @@
+#
+# Common rules that define the run order of tests
+#
+benchtest1.bench:
+benchtest2.bench:
+benchtest3.bench:
+benchtest4.bench:
+benchtest5.bench:
+
+affinity1.pass:
+affinity2.pass: affinity1.pass
+affinity3.pass: affinity2.pass self1.pass create3.pass
+affinity4.pass: affinity3.pass self1.pass create3.pass
+affinity5.pass: affinity4.pass self1.pass create3.pass
+barrier1.pass: semaphore4.pass
+barrier2.pass: barrier1.pass semaphore4.pass
+barrier3.pass: barrier2.pass semaphore4.pass self1.pass create3.pass join4.pass
+barrier4.pass: barrier3.pass semaphore4.pass self1.pass create3.pass join4.pass mutex8.pass
+barrier5.pass: barrier4.pass semaphore4.pass self1.pass create3.pass join4.pass mutex8.pass
+barrier6.pass: barrier5.pass semaphore4.pass self1.pass create3.pass join4.pass mutex8.pass
+cancel1.pass: self1.pass create3.pass
+cancel2.pass: self1.pass create3.pass join4.pass barrier6.pass
+cancel3.pass: self1.pass create3.pass join4.pass context1.pass
+cancel4.pass: cancel3.pass self1.pass create3.pass join4.pass
+cancel5.pass: cancel3.pass self1.pass create3.pass join4.pass
+cancel6a.pass: cancel3.pass self1.pass create3.pass join4.pass
+cancel6d.pass: cancel3.pass self1.pass create3.pass join4.pass
+cancel7.pass: self1.pass create3.pass join4.pass kill1.pass
+cancel8.pass: cancel7.pass self1.pass mutex8.pass kill1.pass
+cancel9.pass: cancel8.pass self1.pass create3.pass join4.pass mutex8.pass kill1.pass
+cleanup0.pass: self1.pass create3.pass join4.pass mutex8.pass cancel5.pass
+cleanup1.pass: cleanup0.pass
+cleanup2.pass: cleanup1.pass
+cleanup3.pass: cleanup2.pass
+condvar1.pass: self1.pass create3.pass semaphore1.pass mutex8.pass
+condvar1_1.pass: condvar1.pass
+condvar1_2.pass: join2.pass
+condvar2.pass: condvar1.pass
+condvar2_1.pass: condvar2.pass join2.pass
+condvar3.pass: create1.pass condvar2.pass
+condvar3_1.pass: condvar3.pass join2.pass
+condvar3_2.pass: condvar3_1.pass
+condvar3_3.pass: condvar3_2.pass
+condvar4.pass: create1.pass
+condvar5.pass: condvar4.pass
+condvar6.pass: condvar5.pass
+condvar7.pass: condvar6.pass cleanup1.pass
+condvar8.pass: condvar7.pass
+condvar9.pass: condvar8.pass
+context1.pass: cancel1.pass
+count1.pass: join1.pass
+create1.pass: mutex2.pass
+create2.pass: create1.pass
+create3.pass: create2.pass
+delay1.pass: self1.pass create3.pass
+delay2.pass: delay1.pass
+detach1.pass: join0.pass
+equal1.pass: self1.pass create1.pass
+errno1.pass: mutex3.pass
+exception1.pass: cancel4.pass
+exception2.pass: exception1.pass
+exception3_0.pass: exception2.pass
+exception3.pass: exception3_0.pass
+exit1.pass: self1.pass create3.pass
+exit2.pass: create1.pass
+exit3.pass: create1.pass
+exit4.pass: self1.pass create3.pass
+exit5.pass: exit4.pass kill1.pass
+eyal1.pass: self1.pass create3.pass mutex8.pass tsd1.pass
+inherit1.pass: join1.pass priority1.pass
+join0.pass: create1.pass
+join1.pass: create1.pass
+join2.pass: create1.pass
+join3.pass: join2.pass
+join4.pass: join3.pass
+kill1.pass: self1.pass
+mutex1.pass: mutex5.pass
+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: sizes.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
+mutex7r.pass: mutex6r.pass
+mutex8.pass: mutex7.pass
+mutex8n.pass: mutex7n.pass
+mutex8e.pass: mutex7e.pass
+mutex8r.pass: mutex7r.pass
+once1.pass: create1.pass
+once2.pass: once1.pass
+once3.pass: once2.pass
+once4.pass: once3.pass
+priority1.pass: join1.pass
+priority2.pass: priority1.pass barrier3.pass
+reuse1.pass: create3.pass
+reuse2.pass: reuse1.pass
+robust1.pass: mutex8r.pass
+robust2.pass: mutex8r.pass
+robust3.pass: robust2.pass
+robust4.pass: robust3.pass
+robust5.pass: robust4.pass
+rwlock1.pass: condvar6.pass
+rwlock2.pass: rwlock1.pass
+rwlock3.pass: rwlock2.pass join2.pass
+rwlock4.pass: rwlock3.pass
+rwlock5.pass: rwlock4.pass
+rwlock6.pass: rwlock5.pass
+rwlock7.pass: rwlock6.pass
+rwlock8.pass: rwlock7.pass
+rwlock2_t.pass: rwlock2.pass
+rwlock3_t.pass: rwlock2_t.pass
+rwlock4_t.pass: rwlock3_t.pass
+rwlock5_t.pass: rwlock4_t.pass
+rwlock6_t.pass: rwlock5_t.pass
+rwlock6_t2.pass: rwlock6_t.pass
+self1.pass: sizes.pass
+self2.pass: self1.pass equal1.pass create1.pass
+semaphore1.pass: sizes.pass
+semaphore2.pass: semaphore1.pass
+semaphore3.pass: semaphore2.pass
+semaphore4.pass: semaphore3.pass cancel1.pass
+semaphore4t.pass: semaphore4.pass
+semaphore5.pass: semaphore4.pass
+sequence1.pass: reuse2.pass
+sizes.pass:
+spin1.pass: self1.pass create3.pass mutex8.pass
+spin2.pass: spin1.pass
+spin3.pass: spin2.pass
+spin4.pass: spin3.pass
+stress1.pass: create3.pass mutex8.pass barrier6.pass
+tsd1.pass: barrier5.pass join1.pass
+tsd2.pass: tsd1.pass
+valid1.pass: join1.pass
+valid2.pass: valid1.pass
diff --git a/pthreads/tests/rwlock1.c b/pthreads/tests/rwlock1.c
index 3d08ac993..e76e920ea 100644
--- a/pthreads/tests/rwlock1.c
+++ b/pthreads/tests/rwlock1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock2.c b/pthreads/tests/rwlock2.c
index 07518ebde..e9aff3248 100644
--- a/pthreads/tests/rwlock2.c
+++ b/pthreads/tests/rwlock2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock2_t.c b/pthreads/tests/rwlock2_t.c
index 4267ddbc8..b4767c7ff 100644
--- a/pthreads/tests/rwlock2_t.c
+++ b/pthreads/tests/rwlock2_t.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock3.c b/pthreads/tests/rwlock3.c
index d30f04088..08bda6e23 100644
--- a/pthreads/tests/rwlock3.c
+++ b/pthreads/tests/rwlock3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock3_t.c b/pthreads/tests/rwlock3_t.c
index 6419de13e..bedcedac2 100644
--- a/pthreads/tests/rwlock3_t.c
+++ b/pthreads/tests/rwlock3_t.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock4.c b/pthreads/tests/rwlock4.c
index a19a00132..b1ff7e0ef 100644
--- a/pthreads/tests/rwlock4.c
+++ b/pthreads/tests/rwlock4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock4_t.c b/pthreads/tests/rwlock4_t.c
index 58b3602fb..770dffbc0 100644
--- a/pthreads/tests/rwlock4_t.c
+++ b/pthreads/tests/rwlock4_t.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock5.c b/pthreads/tests/rwlock5.c
index 3b4054756..2d6e80ccd 100644
--- a/pthreads/tests/rwlock5.c
+++ b/pthreads/tests/rwlock5.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock5_t.c b/pthreads/tests/rwlock5_t.c
index 4a94658fb..8bba06b80 100644
--- a/pthreads/tests/rwlock5_t.c
+++ b/pthreads/tests/rwlock5_t.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock6.c b/pthreads/tests/rwlock6.c
index f667ce5ce..af523b44f 100644
--- a/pthreads/tests/rwlock6.c
+++ b/pthreads/tests/rwlock6.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock6_t.c b/pthreads/tests/rwlock6_t.c
index 71cbe220a..0616d7213 100644
--- a/pthreads/tests/rwlock6_t.c
+++ b/pthreads/tests/rwlock6_t.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/rwlock6_t2.c b/pthreads/tests/rwlock6_t2.c
index b8b0df9f2..c37b86631 100644
--- a/pthreads/tests/rwlock6_t2.c
+++ b/pthreads/tests/rwlock6_t2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/self1.c b/pthreads/tests/self1.c
index c0946f725..8893f6e63 100644
--- a/pthreads/tests/self1.c
+++ b/pthreads/tests/self1.c
@@ -1,69 +1,70 @@
-/*
- * self1.c
- *
- *
- * --------------------------------------------------------------------------
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 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 for pthread_self().
- *
- * Depends on API functions:
- * pthread_self()
- *
- * Implicitly depends on:
- * pthread_getspecific()
- * pthread_setspecific()
- */
-
-#include "test.h"
-
-int
-main(int argc, char * argv[])
-{
- /*
- * This should always succeed unless the system has no
- * resources (memory) left.
- */
- pthread_t self;
-
-#if defined(PTW32_STATIC_LIB) && !(defined(_MSC_VER) || defined(__MINGW32__))
- pthread_win32_process_attach_np();
-#endif
-
- self = pthread_self();
-
- assert(self.p != NULL);
-
-#if defined(PTW32_STATIC_LIB) && !(defined(_MSC_VER) || defined(__MINGW32__))
- pthread_win32_process_detach_np();
-#endif
- return 0;
-}
+/*
+ * self1.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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 for pthread_self().
+ *
+ * Depends on API functions:
+ * pthread_self()
+ *
+ * Implicitly depends on:
+ * pthread_getspecific()
+ * pthread_setspecific()
+ */
+
+#include "test.h"
+
+int
+main(int argc, char * argv[])
+{
+ /*
+ * This should always succeed unless the system has no
+ * resources (memory) left.
+ */
+ pthread_t self;
+
+#if defined(PTW32_STATIC_LIB) && !(defined(_MSC_VER) || defined(__MINGW32__))
+ pthread_win32_process_attach_np();
+#endif
+
+ self = pthread_self();
+
+ assert(self.p != NULL);
+
+#if defined(PTW32_STATIC_LIB) && !(defined(_MSC_VER) || defined(__MINGW32__))
+ pthread_win32_process_detach_np();
+#endif
+ return 0;
+}
diff --git a/pthreads/tests/self2.c b/pthreads/tests/self2.c
index 28e57252e..3fff003da 100644
--- a/pthreads/tests/self2.c
+++ b/pthreads/tests/self2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/semaphore1.c b/pthreads/tests/semaphore1.c
index 8fc91ee02..938f0b59e 100644
--- a/pthreads/tests/semaphore1.c
+++ b/pthreads/tests/semaphore1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -85,7 +86,12 @@ thr(void * arg)
if ( result == -1 )
{
- int err = errno;
+ int err =
+#if defined(PTW32_USES_SEPARATE_CRT)
+ GetLastError();
+#else
+ errno;
+#endif
if (err != EAGAIN)
{
printf("thread: sem_trywait 1: expecting error %s: got %s\n",
@@ -126,7 +132,12 @@ main()
if (result2 == -1)
{
- int err = errno;
+ int err =
+#if defined(PTW32_USES_SEPARATE_CRT)
+ GetLastError();
+#else
+ errno;
+#endif
if (err != EAGAIN)
{
printf("main: sem_trywait 1: expecting error %s: got %s\n",
diff --git a/pthreads/tests/semaphore2.c b/pthreads/tests/semaphore2.c
index af4d0ea70..de56cb310 100644
--- a/pthreads/tests/semaphore2.c
+++ b/pthreads/tests/semaphore2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/semaphore3.c b/pthreads/tests/semaphore3.c
index a0dfcb6f6..842313066 100644
--- a/pthreads/tests/semaphore3.c
+++ b/pthreads/tests/semaphore3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -80,41 +81,43 @@ sem_t s;
void *
thr (void * arg)
{
- assert(sem_wait(&s) == 0);
assert(pthread_detach(pthread_self()) == 0);
+ assert(sem_wait(&s) == 0);
return NULL;
}
int
main()
{
- int value = 0;
- int i;
- pthread_t t[MAX_COUNT+1];
+ int value = 0;
+ int i;
+ pthread_t t[MAX_COUNT+1];
- assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
- assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
- assert(value == 0);
+ assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
+ assert(sem_getvalue(&s, &value) == 0);
+ //printf("Value = %d\n", value); fflush(stdout);
+ assert(value == 0);
- for (i = 1; i <= MAX_COUNT; i++)
- {
- assert(pthread_create(&t[i], NULL, thr, NULL) == 0);
- do {
- sched_yield();
- assert(sem_getvalue(&s, &value) == 0);
- } while (value != -i);
-// printf("Value = %d\n", value); fflush(stdout);
- assert(-value == i);
- }
+ for (i = 1; i <= MAX_COUNT; i++)
+ {
+ assert(pthread_create(&t[i], NULL, thr, NULL) == 0);
+ do
+ {
+ sched_yield();
+ assert(sem_getvalue(&s, &value) == 0);
+ }
+ while (value != -i);
+ //printf("1:Value = %d\n", value); fflush(stdout);
+ assert(-value == i);
+ }
- for (i = MAX_COUNT - 1; i >= 0; i--)
- {
- assert(sem_post(&s) == 0);
- assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
- assert(-value == i);
- }
+ for (i = MAX_COUNT - 1; i >= 0; i--)
+ {
+ assert(sem_post(&s) == 0);
+ assert(sem_getvalue(&s, &value) == 0);
+ //printf("2:Value = %d\n", value); fflush(stdout);
+ assert(-value == i);
+ }
return 0;
}
diff --git a/pthreads/tests/semaphore4.c b/pthreads/tests/semaphore4.c
index 3a28c7b50..eab1d8908 100644
--- a/pthreads/tests/semaphore4.c
+++ b/pthreads/tests/semaphore4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/semaphore4t.c b/pthreads/tests/semaphore4t.c
index 97bc7f88a..56044eca4 100644
--- a/pthreads/tests/semaphore4t.c
+++ b/pthreads/tests/semaphore4t.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/semaphore5.c b/pthreads/tests/semaphore5.c
index 812723433..3644b7343 100644
--- a/pthreads/tests/semaphore5.c
+++ b/pthreads/tests/semaphore5.c
@@ -1,103 +1,104 @@
-/*
- * File: semaphore5.c
- *
- *
- * --------------------------------------------------------------------------
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 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 Synopsis: Verify sem_destroy EBUSY race avoidance
- * -
- *
- * Test Method (Validation or Falsification):
- * - Validation
- *
- * Requirements Tested:
- * -
- *
- * Features Tested:
- * -
- *
- * Cases Tested:
- * -
- *
- * Description:
- * -
- *
- * Environment:
- * -
- *
- * Input:
- * - None.
- *
- * Output:
- * - File name, Line number, and failed expression on failure.
- * - No output on success.
- *
- * Assumptions:
- * -
- *
- * Pass Criteria:
- * - Process returns zero exit status.
- *
- * Fail Criteria:
- * - Process returns non-zero exit status.
- */
-
-// #define ASSERT_TRACE
-
-#include "test.h"
-
-void *
-thr(void * arg)
-{
- assert(sem_post((sem_t *)arg) == 0);
-
- return 0;
-}
-
-
-int
-main()
-{
- pthread_t t;
- sem_t s;
-
- assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
- assert(pthread_create(&t, NULL, thr, (void *)&s) == 0);
-
- assert(sem_wait(&s) == 0);
- assert(sem_destroy(&s) == 0);
-
- assert(pthread_join(t, NULL) == 0);
-
- return 0;
-}
-
+/*
+ * File: semaphore5.c
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
+ * 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 Synopsis: Verify sem_destroy EBUSY race avoidance
+ * -
+ *
+ * Test Method (Validation or Falsification):
+ * - Validation
+ *
+ * Requirements Tested:
+ * -
+ *
+ * Features Tested:
+ * -
+ *
+ * Cases Tested:
+ * -
+ *
+ * Description:
+ * -
+ *
+ * Environment:
+ * -
+ *
+ * Input:
+ * - None.
+ *
+ * Output:
+ * - File name, Line number, and failed expression on failure.
+ * - No output on success.
+ *
+ * Assumptions:
+ * -
+ *
+ * Pass Criteria:
+ * - Process returns zero exit status.
+ *
+ * Fail Criteria:
+ * - Process returns non-zero exit status.
+ */
+
+// #define ASSERT_TRACE
+
+#include "test.h"
+
+void *
+thr(void * arg)
+{
+ assert(sem_post((sem_t *)arg) == 0);
+
+ return 0;
+}
+
+
+int
+main()
+{
+ pthread_t t;
+ sem_t s;
+
+ assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
+ assert(pthread_create(&t, NULL, thr, (void *)&s) == 0);
+
+ assert(sem_wait(&s) == 0);
+ assert(sem_destroy(&s) == 0);
+
+ assert(pthread_join(t, NULL) == 0);
+
+ return 0;
+}
+
diff --git a/pthreads/tests/sequence1.c b/pthreads/tests/sequence1.c
index 46388eebd..51c3da7cb 100644
--- a/pthreads/tests/sequence1.c
+++ b/pthreads/tests/sequence1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/spin1.c b/pthreads/tests/spin1.c
index 00ecd11b1..82af2ca70 100644
--- a/pthreads/tests/spin1.c
+++ b/pthreads/tests/spin1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/spin2.c b/pthreads/tests/spin2.c
index b13c29c4e..267cd5c3a 100644
--- a/pthreads/tests/spin2.c
+++ b/pthreads/tests/spin2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/spin3.c b/pthreads/tests/spin3.c
index bbf8bfb22..e5a89cf57 100644
--- a/pthreads/tests/spin3.c
+++ b/pthreads/tests/spin3.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/spin4.c b/pthreads/tests/spin4.c
index 3a4fd6f24..917104794 100644
--- a/pthreads/tests/spin4.c
+++ b/pthreads/tests/spin4.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/stress1.c b/pthreads/tests/stress1.c
index 7c787dcfb..3b55a660f 100644
--- a/pthreads/tests/stress1.c
+++ b/pthreads/tests/stress1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/test.h b/pthreads/tests/test.h
index 042e87b68..4b3cf591c 100644
--- a/pthreads/tests/test.h
+++ b/pthreads/tests/test.h
@@ -8,10 +8,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
@@ -44,6 +45,7 @@
#include <windows.h>
#include <stdio.h>
+#include <sys/timeb.h>
#define PTW32_THREAD_NULL_ID {NULL,0}
@@ -53,19 +55,19 @@
#define rand_r( _seed ) \
( _seed == _seed? rand() : rand() )
-#if defined(__MINGW32__)
-#include <stdint.h>
+#if defined(PTW32_CONFIG_MINGW)
+# include <stdint.h>
#elif defined(__BORLANDC__)
-#define int64_t ULONGLONG
+# define int64_t ULONGLONG
#else
-#define int64_t _int64
+# define int64_t _int64
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
# define PTW32_FTIME(x) _ftime64_s(x)
# define PTW32_STRUCT_TIMEB struct __timeb64
#elif ( defined(_MSC_VER) && _MSC_VER >= 1300 ) || \
- ( defined(__MINGW32__) && __MSVCRT_VERSION__ >= 0x0601 )
+ ( defined(PTW32_CONFIG_MINGW) && __MSVCRT_VERSION__ >= 0x0601 )
# define PTW32_FTIME(x) _ftime64(x)
# define PTW32_STRUCT_TIMEB struct __timeb64
#else
diff --git a/pthreads/tests/tryentercs.c b/pthreads/tests/tryentercs.c
index 13a6e096d..f94e914eb 100644
--- a/pthreads/tests/tryentercs.c
+++ b/pthreads/tests/tryentercs.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/tryentercs2.c b/pthreads/tests/tryentercs2.c
index a1c4d97f3..2df8cd827 100644
--- a/pthreads/tests/tryentercs2.c
+++ b/pthreads/tests/tryentercs2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/tsd1.c b/pthreads/tests/tsd1.c
index 84d78886c..55c8aed80 100644
--- a/pthreads/tests/tsd1.c
+++ b/pthreads/tests/tsd1.c
@@ -8,10 +8,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/tsd2.c b/pthreads/tests/tsd2.c
index 16e69948c..9f73c08c0 100644
--- a/pthreads/tests/tsd2.c
+++ b/pthreads/tests/tsd2.c
@@ -8,10 +8,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/valid1.c b/pthreads/tests/valid1.c
index a3913fd04..132667952 100644
--- a/pthreads/tests/valid1.c
+++ b/pthreads/tests/valid1.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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
diff --git a/pthreads/tests/valid2.c b/pthreads/tests/valid2.c
index b9671798b..5b04fa6b5 100644
--- a/pthreads/tests/valid2.c
+++ b/pthreads/tests/valid2.c
@@ -6,10 +6,11 @@
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- * Contact Email: rpj@callisto.canberra.edu.au
- *
+ * Copyright(C) 1999,2012 Pthreads-win32 contributors
+ *
+ * Homepage1: http://sourceware.org/pthreads-win32/
+ * Homepage2: http://sourceforge.net/projects/pthreads4w/
+ *
* 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