aboutsummaryrefslogtreecommitdiff
path: root/pthreads/tests
diff options
context:
space:
mode:
Diffstat (limited to 'pthreads/tests')
-rw-r--r--pthreads/tests/Bmakefile712
-rw-r--r--pthreads/tests/ChangeLog1918
-rw-r--r--pthreads/tests/GNUmakefile850
-rw-r--r--pthreads/tests/Makefile891
-rw-r--r--pthreads/tests/SIZES.GC42
-rw-r--r--pthreads/tests/SIZES.GCE16
-rw-r--r--pthreads/tests/SIZES.VC41
-rw-r--r--pthreads/tests/SIZES.VCE40
-rw-r--r--pthreads/tests/SIZES.VSE40
-rw-r--r--pthreads/tests/Wmakefile704
-rw-r--r--pthreads/tests/barrier3.c8
-rw-r--r--pthreads/tests/barrier5.c236
-rw-r--r--pthreads/tests/benchtest1.c55
-rw-r--r--pthreads/tests/benchtest2.c38
-rw-r--r--pthreads/tests/benchtest3.c36
-rw-r--r--pthreads/tests/benchtest4.c36
-rw-r--r--pthreads/tests/benchtest5.c20
-rw-r--r--pthreads/tests/cancel1.c2
-rw-r--r--pthreads/tests/cancel2.c31
-rw-r--r--pthreads/tests/cancel3.c402
-rw-r--r--pthreads/tests/cancel4.c10
-rw-r--r--pthreads/tests/cancel5.c10
-rw-r--r--pthreads/tests/cancel6a.c10
-rw-r--r--pthreads/tests/cancel6d.c17
-rw-r--r--pthreads/tests/cancel7.c8
-rw-r--r--pthreads/tests/cancel8.c8
-rw-r--r--pthreads/tests/cleanup0.c10
-rw-r--r--pthreads/tests/cleanup1.c10
-rw-r--r--pthreads/tests/cleanup2.c10
-rw-r--r--pthreads/tests/cleanup3.c10
-rw-r--r--pthreads/tests/condvar1_2.c6
-rw-r--r--pthreads/tests/condvar2.c6
-rw-r--r--pthreads/tests/condvar2_1.c14
-rw-r--r--pthreads/tests/condvar3.c6
-rw-r--r--pthreads/tests/condvar3_1.c14
-rw-r--r--pthreads/tests/condvar3_2.c16
-rw-r--r--pthreads/tests/condvar3_3.c8
-rw-r--r--pthreads/tests/condvar4.c10
-rw-r--r--pthreads/tests/condvar5.c10
-rw-r--r--pthreads/tests/condvar6.c6
-rw-r--r--pthreads/tests/condvar7.c6
-rw-r--r--pthreads/tests/condvar8.c6
-rw-r--r--pthreads/tests/condvar9.c6
-rw-r--r--pthreads/tests/create2.c3
-rw-r--r--pthreads/tests/delay2.c8
-rw-r--r--pthreads/tests/detach1.c4
-rw-r--r--pthreads/tests/exception1.c28
-rw-r--r--pthreads/tests/exception2.c4
-rw-r--r--pthreads/tests/exception3.c23
-rw-r--r--pthreads/tests/exit2.c2
-rw-r--r--pthreads/tests/exit3.c4
-rw-r--r--pthreads/tests/exit4.c4
-rw-r--r--pthreads/tests/exit5.c4
-rw-r--r--pthreads/tests/inherit1.c4
-rw-r--r--pthreads/tests/join0.c6
-rw-r--r--pthreads/tests/join1.c10
-rw-r--r--pthreads/tests/join2.c8
-rw-r--r--pthreads/tests/join3.c8
-rw-r--r--pthreads/tests/mutex1e.c4
-rw-r--r--pthreads/tests/mutex1n.c4
-rw-r--r--pthreads/tests/mutex1r.c4
-rw-r--r--pthreads/tests/mutex4.c24
-rw-r--r--pthreads/tests/mutex6e.c15
-rw-r--r--pthreads/tests/mutex6es.c6
-rw-r--r--pthreads/tests/mutex6n.c21
-rw-r--r--pthreads/tests/mutex6r.c15
-rw-r--r--pthreads/tests/mutex6rs.c6
-rw-r--r--pthreads/tests/mutex7.c2
-rw-r--r--pthreads/tests/mutex7e.c16
-rw-r--r--pthreads/tests/mutex7n.c13
-rw-r--r--pthreads/tests/mutex7r.c15
-rw-r--r--pthreads/tests/mutex8.c6
-rw-r--r--pthreads/tests/mutex8e.c14
-rw-r--r--pthreads/tests/mutex8n.c14
-rw-r--r--pthreads/tests/mutex8r.c14
-rw-r--r--pthreads/tests/once2.c6
-rw-r--r--pthreads/tests/once3.c264
-rw-r--r--pthreads/tests/openmp1.c140
-rw-r--r--pthreads/tests/priority1.c6
-rw-r--r--pthreads/tests/priority2.c4
-rw-r--r--pthreads/tests/reuse1.c6
-rw-r--r--pthreads/tests/reuse2.c3
-rw-r--r--pthreads/tests/robust1.c141
-rw-r--r--pthreads/tests/robust2.c143
-rw-r--r--pthreads/tests/robust3.c149
-rw-r--r--pthreads/tests/robust4.c199
-rw-r--r--pthreads/tests/robust5.c120
-rw-r--r--pthreads/tests/rwlock2_t.c6
-rw-r--r--pthreads/tests/rwlock3.c4
-rw-r--r--pthreads/tests/rwlock3_t.c6
-rw-r--r--pthreads/tests/rwlock4.c4
-rw-r--r--pthreads/tests/rwlock4_t.c6
-rw-r--r--pthreads/tests/rwlock5.c4
-rw-r--r--pthreads/tests/rwlock5_t.c6
-rw-r--r--pthreads/tests/rwlock6.c28
-rw-r--r--pthreads/tests/rwlock6_t.c42
-rw-r--r--pthreads/tests/rwlock6_t2.c38
-rw-r--r--pthreads/tests/rwlock7.c18
-rw-r--r--pthreads/tests/rwlock8.c18
-rw-r--r--pthreads/tests/semaphore1.c49
-rw-r--r--pthreads/tests/semaphore4.c10
-rw-r--r--pthreads/tests/semaphore4t.c3
-rw-r--r--pthreads/tests/sequence1.c (renamed from pthreads/tests/create3.c)96
-rw-r--r--pthreads/tests/sizes.c36
-rw-r--r--pthreads/tests/spin3.c10
-rw-r--r--pthreads/tests/spin4.c20
-rw-r--r--pthreads/tests/stress1.c556
-rw-r--r--pthreads/tests/test.h322
-rw-r--r--pthreads/tests/tsd1.c4
-rw-r--r--pthreads/tests/tsd2.c4
-rw-r--r--pthreads/tests/valid1.c2
111 files changed, 5166 insertions, 3955 deletions
diff --git a/pthreads/tests/Bmakefile b/pthreads/tests/Bmakefile
index b561cad8c..df2ac1b1b 100644
--- a/pthreads/tests/Bmakefile
+++ b/pthreads/tests/Bmakefile
@@ -1,354 +1,358 @@
-# Makefile for the pthreads test suite.
-# If all of the .pass files can be created, the test suite has passed.
-#
-# --------------------------------------------------------------------------
-#
-# 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
-#
-
-DLL_VER = 2
-
-CP = copy
-RM = erase
-CAT = type
-MKDIR = mkdir
-TOUCH = echo Passed >
-ECHO = @echo
-
-# The next path is relative to $BUILD_DIR
-QAPC = ..\QueueUserAPCEx\User\quserex.dll
-
-CPHDR = pthread.h semaphore.h sched.h
-
-OPTIM = -O2
-
-XXLIBS = cw32mti.lib ws2_32.lib
-
-# C++ Exceptions
-BCEFLAGS = -P -DPtW32NoCatchWarn -D__CLEANUP_CXX
-BCELIB = pthreadBCE$(DLL_VER).lib
-BCEDLL = pthreadBCE$(DLL_VER).dll
-# C cleanup code
-BCFLAGS = -D__CLEANUP_C
-BCLIB = pthreadBC$(DLL_VER).lib
-BCDLL = pthreadBC$(DLL_VER).dll
-# C++ Exceptions in application - using VC version of pthreads dll
-BCXFLAGS = -D__CLEANUP_C
-
-# Defaults
-CPLIB = $(BCLIB)
-CPDLL = $(BCDLL)
-
-CFLAGS= -q $(OPTIM) /D_WIN32_WINNT=0x400 -w -tWC -tWM -4 -w-aus -w-asc -w-par
-LFLAGS=
-INCLUDES=-I.
-BUILD_DIR=..
-
-COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
-
-EHFLAGS =
-
-# If a test case returns a non-zero exit code to the shell, make will
-# stop.
-
-PASSES= loadfree.pass \
- errno1.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 \
- 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 \
- 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 \
- 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 create3.pass stress1.pass
-
-BENCHRESULTS = \
- benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench \
- benchtest6.bench
-
-help:
- @ $(ECHO) Run one of the following command lines:
- @ $(ECHO) make clean BC (to test using BC dll with VC (no EH) applications)
- @ $(ECHO) make clean BCX (to test using BC dll with VC++ (EH) applications)
- @ $(ECHO) make clean BCE (to test using the BCE dll with VC++ EH applications)
- @ $(ECHO) make clean BC-bench (to benchtest using BC dll with C bench app)
- @ $(ECHO) make clean BCX-bench (to benchtest using BC dll with C++ bench app)
- @ $(ECHO) make clean BCE-bench (to benchtest using BCE dll with C++ bench app)
-
-all:
- @ make clean BC
- @ make clean BCX
- @ make clean BCE
- @ make clean BC-bench
-
-# This allows an individual test application to be made using the default lib.
-# e.g. make clean test cancel3.exe
-test: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC)
-
-tests: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC) sizes.pass $(PASSES)
- @ $(ECHO) ALL TESTS PASSED! Congratulations!
-
-benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(BENCHRESULTS)
- @ $(ECHO) ALL BENCH TESTS DONE.
-
-sizes.pass: sizes.exe
- @ $(ECHO) ... Running $(TEST) test: $*.exe
- @ .\$*.exe > SIZES.$(TEST)
- @ $(CAT) SIZES.$(TEST)
- @ $(ECHO) ...... Passed
- @ $(TOUCH) $*.pass
-
-BCE:
- @ make -f Bmakefile TEST="$@" CPLIB="$(BCELIB)" CPDLL="$(BCEDLL)" EHFLAGS="$(BCEFLAGS)" tests
-
-BC:
- @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCFLAGS)" tests
-
-BCX:
- @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCXFLAGS)" tests
-
-BCE-bench:
- @ make -f Bmakefile TEST="$@" CPLIB="$(BCELIB)" CPDLL="$(BCEDLL)" EHFLAGS="$(BCEFLAGS)" XXLIBS="benchlib.o" benchtests
-
-BC-bench:
- @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCFLAGS)" XXLIBS="benchlib.o" benchtests
-
-BCX-bench:
- @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCXFLAGS)" XXLIBS="benchlib.o" benchtests
-
-.exe.pass:
- @ $(ECHO) ... Running $(TEST) test: $<
- @ .\$<
- @ $(ECHO) ...... Passed
- @ $(TOUCH) $@
-
-.exe.bench:
- @ $(ECHO) ... Running $(TEST) benchtest: $<
- @ .\$<
- @ $(ECHO) ...... Done
- @ $(TOUCH) $@
-
-.c.exe:
- @ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< -e$@ $(LFLAGS) $(CPLIB) $(XXLIBS)
- @ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< -e$@ $(LFLAGS) $(CPLIB) $(XXLIBS)
-
-.c.o:
- @ $(ECHO) $(CC) $(EHFLAGS) -c $(CFLAGS) $(INCLUDES) $< -o$@
- @ $(CC) $(EHFLAGS) $(CFLAGS) -c $(INCLUDES) $< -o$@
-
-
-.c.i:
- @ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
-
-$(COPYFILES):
- @ $(ECHO) Copying $(BUILD_DIR)\$@
- @ $(CP) $(BUILD_DIR)\$@ .
-
-pthread.dll: $(CPDLL)
- @ $(CP) $(CPDLL) pthread.dll
- @ $(CP) $(CPLIB) pthread.lib
-
-clean:
- - $(RM) *.dll
- - $(RM) *.lib
- - $(RM) pthread.h
- - $(RM) semaphore.h
- - $(RM) sched.h
- - $(RM) *.e
- - $(RM) *.i
- - $(RM) *.obj
- - $(RM) *.tds
- - $(RM) *.pdb
- - $(RM) *.o
- - $(RM) *.asm
- - $(RM) *.exe
- - $(RM) *.pass
- - $(RM) *.bench
- - $(RM) *.log
-
-benchtest1.bench:
-benchtest2.bench:
-benchtest3.bench:
-benchtest4.bench:
-benchtest5.bench:
-benchtest6.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: cancel2.pass
-count1.pass: join1.pass
-create1.pass: mutex2.pass
-create2.pass: create1.pass
-create3.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
-rwlock1.pass: condvar6.pass
-rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.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
-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
+# Makefile for the pthreads test suite.
+# If all of the .pass files can be created, the test suite has passed.
+#
+# --------------------------------------------------------------------------
+#
+# 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
+#
+
+DLL_VER = 2
+
+CP = copy
+RM = erase
+CAT = type
+MKDIR = mkdir
+TOUCH = echo Passed >
+ECHO = @echo
+
+# The next path is relative to $BUILD_DIR
+QAPC = # ..\QueueUserAPCEx\User\quserex.dll
+
+CPHDR = pthread.h semaphore.h sched.h
+
+OPTIM = -O2
+
+XXLIBS = cw32mti.lib ws2_32.lib
+
+# C++ Exceptions
+BCEFLAGS = -P -DPtW32NoCatchWarn -D__CLEANUP_CXX
+BCELIB = pthreadBCE$(DLL_VER).lib
+BCEDLL = pthreadBCE$(DLL_VER).dll
+# C cleanup code
+BCFLAGS = -D__CLEANUP_C
+BCLIB = pthreadBC$(DLL_VER).lib
+BCDLL = pthreadBC$(DLL_VER).dll
+# C++ Exceptions in application - using VC version of pthreads dll
+BCXFLAGS = -D__CLEANUP_C
+
+# Defaults
+CPLIB = $(BCLIB)
+CPDLL = $(BCDLL)
+
+CFLAGS= -q $(OPTIM) /D_WIN32_WINNT=0x400 -w -tWC -tWM -4 -w-aus -w-asc -w-par
+LFLAGS=
+INCLUDES=-I.
+BUILD_DIR=..
+
+COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
+
+EHFLAGS =
+
+# If a test case returns a non-zero exit code to the shell, make will
+# stop.
+
+PASSES= loadfree.pass \
+ errno1.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 \
+ 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
+
+help:
+ @ $(ECHO) Run one of the following command lines:
+ @ $(ECHO) make clean BC (to test using BC dll with VC (no EH) applications)
+ @ $(ECHO) make clean BCX (to test using BC dll with VC++ (EH) applications)
+ @ $(ECHO) make clean BCE (to test using the BCE dll with VC++ EH applications)
+ @ $(ECHO) make clean BC-bench (to benchtest using BC dll with C bench app)
+ @ $(ECHO) make clean BCX-bench (to benchtest using BC dll with C++ bench app)
+ @ $(ECHO) make clean BCE-bench (to benchtest using BCE dll with C++ bench app)
+
+all:
+ @ make clean BC
+ @ make clean BCX
+ @ make clean BCE
+ @ make clean BC-bench
+
+# This allows an individual test application to be made using the default lib.
+# e.g. make clean test cancel3.exe
+test: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC)
+
+tests: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC) sizes.pass $(PASSES)
+ @ $(ECHO) ALL TESTS PASSED! Congratulations!
+
+benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(BENCHRESULTS)
+ @ $(ECHO) ALL BENCH TESTS DONE.
+
+sizes.pass: sizes.exe
+ @ $(ECHO) ... Running $(TEST) test: $*.exe
+ @ .\$*.exe > SIZES.$(TEST)
+ @ $(CAT) SIZES.$(TEST)
+ @ $(ECHO) ...... Passed
+ @ $(TOUCH) $*.pass
+
+BCE:
+ @ make -f Bmakefile TEST="$@" CPLIB="$(BCELIB)" CPDLL="$(BCEDLL)" EHFLAGS="$(BCEFLAGS)" tests
+
+BC:
+ @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCFLAGS)" tests
+
+BCX:
+ @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCXFLAGS)" tests
+
+BCE-bench:
+ @ make -f Bmakefile TEST="$@" CPLIB="$(BCELIB)" CPDLL="$(BCEDLL)" EHFLAGS="$(BCEFLAGS)" XXLIBS="benchlib.o" benchtests
+
+BC-bench:
+ @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCFLAGS)" XXLIBS="benchlib.o" benchtests
+
+BCX-bench:
+ @ make -f Bmakefile TEST="$@" CPLIB="$(BCLIB)" CPDLL="$(BCDLL)" EHFLAGS="$(BCXFLAGS)" XXLIBS="benchlib.o" benchtests
+
+.exe.pass:
+ @ $(ECHO) ... Running $(TEST) test: $<
+ @ .\$<
+ @ $(ECHO) ...... Passed
+ @ $(TOUCH) $@
+
+.exe.bench:
+ @ $(ECHO) ... Running $(TEST) benchtest: $<
+ @ .\$<
+ @ $(ECHO) ...... Done
+ @ $(TOUCH) $@
+
+.c.exe:
+ @ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< -e$@ $(LFLAGS) $(CPLIB) $(XXLIBS)
+ @ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< -e$@ $(LFLAGS) $(CPLIB) $(XXLIBS)
+
+.c.o:
+ @ $(ECHO) $(CC) $(EHFLAGS) -c $(CFLAGS) $(INCLUDES) $< -o$@
+ @ $(CC) $(EHFLAGS) $(CFLAGS) -c $(INCLUDES) $< -o$@
+
+
+.c.i:
+ @ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
+
+$(COPYFILES):
+ @ $(ECHO) Copying $(BUILD_DIR)\$@
+ @ $(CP) $(BUILD_DIR)\$@ .
+
+pthread.dll: $(CPDLL)
+ @ $(CP) $(CPDLL) pthread.dll
+ @ $(CP) $(CPLIB) pthread.lib
+
+clean:
+ - $(RM) *.dll
+ - $(RM) *.lib
+ - $(RM) pthread.h
+ - $(RM) semaphore.h
+ - $(RM) sched.h
+ - $(RM) *.e
+ - $(RM) *.i
+ - $(RM) *.obj
+ - $(RM) *.tds
+ - $(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:
+tsd1.pass: barrier5.pass join1.pass
+tsd2.pass: tsd1.pass
+valid1.pass: join1.pass
+valid2.pass: valid1.pass
diff --git a/pthreads/tests/ChangeLog b/pthreads/tests/ChangeLog
index b254381b2..dfb4f4555 100644
--- a/pthreads/tests/ChangeLog
+++ b/pthreads/tests/ChangeLog
@@ -1,918 +1,1000 @@
-2010-06-19 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
-
- * Makefile (STATICRESULTS): Add all tests into suite for static
- library.
- * GNUmakefile (STATICTESTS): Likewise, except for openmp1.c which
- has a DLL dependency.
-
-2010-02-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
-
- * openmp1.c: New; for libgomp compatibility (OpenMP).
- * barrier5.c: Rewrite after changes to barriers.
- * barrier6.c: New.
- * benchtest6.c: New; timing barriers.
- * GNUMakefile: Update for new tests.
- * Makefile: Ditto.
- * BMakefile: Ditto.
- * once3.c: Improve cancelation testing.
- * stress1.c: Fix comment.
-
-2007-01-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
-
- * context1.c: Include context.h from library sources and remove
- x86 dependence in main().
-
-2005-06-12 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * stress1.c (millisecondsFromNow): Remove limit 0 <= millisecs < 1000;
- now works for -INT_MAX <= millisecs <= INT_MAX; not needed for
- stress1.c but should be general anyway.
-
-2005-05-18 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * reuse2.c (main): Must use a read with memory barrier semantics
- when polling 'done' to force the cache into coherence on MP systems.
-
-2005-05-15 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * detach1.c: New test.
- * join1.c: Reduce sleep times.
- * join0.c: Remove MSVCRT conditional compile - join should always
- return the thread exit code.
- * join1.c: Likewise.
- * join2.c: Likewise.
- * join3.c: Likewise.
-
-2005-04-18 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * condvar3.c: Remove locks from around signalling calls - should not
- be required for normal operation and only serve to mask deficiencies;
- ensure that CV destruction is not premature after removing guards.
- * condvar3_1.c: Likewise.
- * condvar3_2.c: Likewise.
- * condvar3_3.c: Likewise.
- * condvar4.c: Likewise.
- * condvar5.c: Likewise.
- * condvar6.c: Likewise.
- * condvar7.c: Likewise.
- * condvar8.c: Likewise.
- * condvar9.c: Likewise.
-
-2005-04-11 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * once4.c: New test; tries to test priority adjustments
- in pthread_once(); set priority class to realtime so that
- any failures can be seen.
-
-2005-04-06 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * cleanup0.c: Fix unguarded global variable accesses.
- * cleanup1.c: Likewise.
- * cleanup2.c: Likewise.
- * cleanup3.c: Likewise.
- * once2.c: Likewise.
- * once3.c: Likewise.
-
-2005-04-01 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * GNUmakefile: Add target to test linking static link library.
- * Makefile: Likewise.
- * self1.c: Run process attach/detach routines when static linked.
-
-2005-03-16 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * mutex5.c: Prevent optimiser from removing asserts.
-
-2005-03-12 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * once3.c: New test.
-
-2005-03-08 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * once2.c: New test.
-
-2004-11-19 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * Bmakefile: New makefile for Borland.
- * Makefile (DLL_VER): Added.
- * GNUmakefile (DLL_VER): Added.
- * Wmakefile (DLL_VER): Added.
-
-2004-10-29 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * semaphore4.c: New test.
- * semaphore4t.c: New test.
- * Debug.dsp (et al): Created MSVC Workspace project to aid debugging.
- * All: Many tests have been modified to work with the new pthread
- ID type; some other corrections were made after some library
- functions were semantically strengthened. For example,
- pthread_cond_destroy() no longer destroys a busy CV, which
- required minor redesigns of some tests, including some where
- the mutex associated with the CV was not locked during
- signaling and broadcasting.
-
-2004-10-23 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * condvar3.c: Fixed mutex operations that were incorrectly
- placed in relation to their condition variable operations.
- The error became evident after sem_destroy() was rewritten
- and conditions for destroing the semaphore were tightened.
- As a result, pthread_cond_destroy() was not able to
- destroy the cv queueing sempahore.
- * condvar3_1.c: Likewise.
- * condvar3_2.c: Likewise.
- * condvar4.c: Likewise.
- * condvar5.c: Likewise.
- * condvar6.c: Likewise.
- * condvar7.c: Likewise.
- * condvar8.c: Likewise.
- * condvar9.c: Likewise.
-
-2004-10-19 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * semaphore3.c: New test.
-
-2004-10-14 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * rwlock7.c (main): Tidy up statistics reporting; randomise
- update accesses.
- * rwlock8.c: New test.
-
-2004-09-08 Alexandre Girao <alexgirao@gmail.com>
-
- * cancel7.c (main): Win98 wants a valid (non-NULL) location
- for the last arg of _beginthreadex().
- * cancel8.c (main): Likewise.
- * exit4.c (main): Likewise.
- * exit5.c (main): Likewise.
-
-2004-08-26 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * create3.c: New test.
-
-2004-06-21 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * mutex2r.c: New test.
- * mutex2e.c: New test.
- * mutex3r.c: New test.
- * mutex3e.c: New test.
- * mutex6s.c: New test.
- * mutex6rs.c: New test.
- * mutex6es.c: New test.
-
-2004-05-21 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * join3.c: New test.
-
-2004-05-16 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * condvar2.c (WIN32_WINNT): Define to avoid redefinition warning
- from inclusion of implement.h.
- * convar2_1.c: Likewise.
- * condvar3_1.c: Likewise.
- * condvar3_2.c: Likewise.
- * context1.c: Likewise.
- * sizes.c: Likewise.
- * Makefile: Don't define _WIN32_WINNT on compiler command line.
- * GNUmakefile: Likewise.
- * priority1.c (main): Add column to output for actual win32
- priority.
-
-2004-05-16 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * cancel9.c: New test.
- * cancel3.c: Remove inappropriate conditional compilation;
- GNU C version of test suite no longer quietly skips this test.
- * cancel5.c: Likewise.
- * GNUmakefile: Can now build individual test app using default
- C version of library using 'make clean testname.c'.
- * Makefile: Likewise for VC using 'nmake clean test testname.c'.
-
-2003-10-14 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * Wmakefile: New makefile for Watcom testing.
-
-2003-09-18 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * benchtest.h: Move old mutex code into benchlib.c.
- * benchlib.c: New statically linked module to ensure that
- bench apps don't inline the code and therefore have an unfair
- advantage over the pthreads lib routines. Made little or no
- difference.
- * benchtest1.c: Minor change to avoid compiler warnings.
- * benchtest5.c: Likewise.
- * benchtest2.c: Fix misinformation in output report.
- * README.BENCH: Add comments on results.
-
-2003-09-14 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * priority1.c: Reworked to comply with modified priority
- management and provide additional output.
- * priority2.c: Likewise.
- * inherit1.c: Likewise.
-
-2003-09-03 Ross Johnson <rpj@callisto.canberra.edu.au>
-
- * exit4.c: New test.
- * exit5.c: New test.
- * cancel7.c: New test.
- * cancel8.c: New test.
-
-2003-08-13 Ross Johnson <rpj@ise.canberra.edu.au>
-
- * reuse1.c: New test.
- * reuse1.c: New test.
- * valid1.c: New test.
- * valid2.c: New test.
- * kill1.c: New test.
- * create2.c: Now included in test regime.
-
-2003-07-19 Ross Johnson <rpj@ise.canberra.edu.au>
-
- * eyal1.c (waste_time): Make threads do more work to ensure that
- all threads get to do some work.
- * semaphore1.c: Make it clear that certain errors are expected.
- * exception2.c (non_MSVC code sections): Change to include
- C++ standard include file, i.e. change <new.h> to <exception>.
- * exception3.c (non_MSVC code sections): Likewise; qualify std::
- namespace entities where necessary.
- * GNUmakefile: modified to work in the MsysDTK (newer MinGW)
- environment; define CC as gcc or g++ as appropriate because
- using gcc -x c++ doesn't link with required c++ libs by default,
- but g++ does.
-
-2002-12-11 Ross Johnson <ross@special.ise.canberra.edu.au>
-
- * mutex7e.c: Assert EBUSY return instead of EDEADLK.
-
-2002-06-03 Ross Johnson <rpj@digit.ise.canberra.edu.au>
-
- * semaphore2.c: New test.
-
-2002-03-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * Makefile (CFLAGS): Changed /MT to /MD to link with
- the correct library MSVCRT.LIB. Otherwise errno doesn't
- work.
-
-2002-02-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * exception3.c: Correct recent change.
-
- * semaphore1.c: New test.
-
- * Makefile: Add rule to generate pre-processor output.
-
-2002-02-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * exception3.c (terminateFunction): For MSVC++, call
- exit() rather than pthread_exit(). Add comments to explain
- why.
- * 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. Therefore
- * term_func() should not call pthread_exit() if an
- * an exception-using version of pthreads-win32 library
- * is being used (i.e. either pthreadVCE or pthreadVSE).
-
-
-2002-02-23 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * rwlock2_t.c: New test.
- * rwlock3_t.c: New test.
- * rwlock4_t.c: New test.
- * rwlock5_t.c: New test.
- * rwlock6_t.c: New test.
- * rwlock6_t2.c: New test.
- * rwlock6.c (main): Swap thread and result variables
- to correspond to actual thread functions.
- * rwlock1.c: Change test description comment to correspond
- to the actual test.
-
- * condvar1_2.c: Loop over the test many times in the hope
- of detecting any intermittent deadlocks. This is to
- test a fixed problem in pthread_cond_destroy.c.
-
- * spin4.c: Remove unused variable.
-
-2002-02-17 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * condvar1_1.c: New test.
- * condvar1_2.c: New test.
-
-2002-02-07 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * delay1.c: New test.
- * delay2.c: New test.
- * exit4.c: New test.
-
-2002-02-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * mutex8: New test.
- * mutex8n: New test.
- * mutex8e: New test.
- * mutex8r: New test.
- * cancel6a: New test.
- * cancel6d: New test.
- * cleanup0.c: Add pragmas for inline optimisation control.
- * cleanup1.c: Add pragmas for inline optimisation control.
- * cleanup2.c: Add pragmas for inline optimisation control.
- * cleanup3.c: Add pragmas for inline optimisation control.
- * condvar7.c: Add pragmas for inline optimisation control.
- * condvar8.c: Add pragmas for inline optimisation control.
- * condvar9.c: Add pragmas for inline optimisation control.
-
-2002-01-30 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * cleanup1.c (): Must be declared __cdecl when compiled
- as C++ AND testing the standard C library version.
-
-2002-01-16 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * spin4.c (main): Fix renamed function call.
-
-2002-01-14 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * exception3.c (main): Shorten wait time.
-
-2002-01-09 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * mutex7.c: New test.
- * mutex7n.c: New test.
- * mutex7e.c: New test.
- * mutex7r.c: New test.
- * mutex6.c: Modified to avoid leaving the locked mutex
- around on exit.
-
-2001-10-25 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
-
- * condvar2.c: Remove reference to cv->nWaitersUnblocked.
- * condvar2_1.c: Likewise; lower NUMTHREADS from 60 to 30.
- * condvar3_1.c: Likewise.
- * condvar3_2.c: Likewise.
- * count1.c: lower NUMTHREADS from 60 to 30.
- * inherit1.c: Determine valid priority values and then
- assert values returned by POSIX routines are the same.
- * priority1.c: Likewise.
- * priority2.c: Likewise.
-
-2001-07-12 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
-
- * barrier5.c: Assert that precisely one thread receives
- PTHREAD_BARRIER_SERIAL_THREAD at each barrier.
-
-2001-07-09 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
-
- * barrier3.c: Fixed.
- * barrier4.c: Fixed.
- * barrier5.c: New; proves that all threads in the group
- reaching the barrier wait and then resume together. Repeats the test
- using groups of 1 to 16 threads. Each group of threads must negotiate
- a large number of barriers (10000).
- * spin4.c: Fixed.
- * test.h (error_string): Modified the success (0) value.
-
-2001-07-07 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
-
- * spin3.c: Changed test and fixed.
- * spin4.c: Fixed.
- * barrier3.c: Fixed.
- * barrier4.c: Fixed.
-
-2001-07-05 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * spin1.c: New; testing spinlocks.
- * spin2.c: New; testing spinlocks.
- * spin3.c: New; testing spinlocks.
- * spin4.c: New; testing spinlocks.
- * barrier1.c: New; testing barriers.
- * barrier2.c: New; testing barriers.
- * barrier3.c: New; testing barriers.
- * barrier4.c: New; testing barriers.
- * GNUmakefile: Add new tests.
- * Makefile: Add new tests.
-
-2001-07-01 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * benchtest3.c: New; timing mutexes.
- * benchtest4.c: New; time mutexes.
- * condvar3_1.c: Fixed bug - Alexander Terekhov
- * condvar3_3.c: New test.
-
-2001-06-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * priority1.c: New test.
- * priority2.c: New test.
- * inherit1.c: New test.
- * benchtest1.c: New; timing mutexes.
- * benchtest2.c: New; timing mutexes.
- * mutex4.c: Modified to test all mutex types.
-
-2001-06-8 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * mutex5.c: Insert inert change to quell compiler warnings.
- * condvar3_2.c: Remove unused variable.
-
-2001-06-3 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * condvar2_1.c: New test.
- * condvar3_1.c: New test.
- * condvar3_2.c: New test.
-
-2001-05-30 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * mutex1n.c: New test.
- * mutex1e.c: New test.
- * mutex1r.c: New test.
- * mutex4.c: Now locks and unlocks a mutex.
- * mutex5.c: New test.
- * mutex6.c: New test.
- * mutex6n.c: New test.
- * mutex6e.c: New test.
- * mutex6r.c: New test.
- * Makefile: Added new tests; reorganised.
- * GNUmakefile: Likewise.
- * rwlock6.c: Fix to properly prove read-while-write locking
- and single writer locking.
-
-2001-05-29 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * Makefile: Reorganisation.
- * GNUmakefile: Likewise.
- - Thomas Pfaff <tpfaff@gmx.net>
-
- * exception1.c: Add stdio.h include to define fprintf and stderr
- in non-exception C version of main().
- * exception2.c: Likewise.
- * exception3.c: Likewise.
-
- * Makefile (rwlock7): Add new test.
- * GNUmakefile (rwlock7): Add new test.
- * rwlock7.c: New test.
- * rwlock6.c: Changed to test that writer has priority.
-
- * eyal1.c (main): Unlock each mutex_start lock before destroying
- it.
-
-2000-12-29 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * GNUmakefile: Add mutex4 test; ensure libpthreadw32.a is
- removed for "clean" target.
- * Makefile: Add mutex4 test.
-
- * exception3.c: Remove SEH code; automatically pass the test
- under SEH (which is an N/A environment).
-
- * mutex4.c: New test.
-
- * eyal1.c (do_work_unit): Add a dummy "if" to force the
- optimiser to retain code; reduce thread work loads.
-
- * condvar8.c (main): Add an additional "assert" for debugging;
- increase pthread_cond_signal timeout.
-
-2000-12-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * eyal1.c: Increase thread work loads.
- * exception2.c: New test.
- * exception3.c: New test.
- * Makefile: Add new tests exception2.c and exception3.c.
- * GNUmakefile: Likewise.
-
-2000-12-11 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * cleanup3.c: Remove unused variable.
- * cleanup2.c: Likewise.
- * exception1.c: Throw an exception rather than use
- a deliberate zero divide so that catch(...) will
- handle it under Mingw32. Mingw32 now builds the
- library correctly to pass all tests - see Thomas
- Pfaff's detailed instructions re needed changes
- to Mingw32 in the Pthreads-Win32 FAQ.
-
-2000-09-08 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * cancel5.c: New; tests calling pthread_cancel()
- from the main thread without first creating a
- POSIX thread struct for the non-POSIX main thread
- - this forces pthread_cancel() to create one via
- pthread_self().
- * Makefile (cancel5): Add new test.
- * GNUmakefile (cancel5): Likewise.
-
-2000-08-17 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * create2.c: New; Test that pthread_t contains
- the W32 HANDLE before it calls the thread routine
- proper.
-
-2000-08-13 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * condvar3.c: Minor change to eliminate compiler
- warning.
-
- * condvar4.c: ditto.
-
- * condvar5.c: ditto.
-
- * condvar6.c: ditto.
-
- * condvar7.c: ditto.
-
- * condvar8.c: ditto.
-
- * condvar9.c: ditto.
-
- * exit1.c: Function needed return statement.
-
- * cleanup1.c: Remove unnecessary printf arg.
-
- * cleanup2.c: Fix cast.
-
- * rwlock6.c: Fix casts.
-
- * exception1.c (PtW32CatchAll): Had the wrong name;
- fix casts.
-
- * cancel3.c: Remove unused waitLock variable.
-
- * GNUmakefile: Change library/dll naming; add new tests;
- general minor changes.
-
- * Makefile: Change library/dll naming; add targets for
- testing each of the two VC++ EH scheme versions;
- default target now issues help message; compile warnings
- now interpreted as errors to stop the make; add new
- tests; restructure to remove prerequisites needed
- otherwise.
-
- * README: Updated.
-
-
-2000-08-10 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * eyal1.c (main): Change implicit cast to explicit
- cast when passing "print_server" function pointer;
- G++ no longer allows implicit func parameter casts.
-
- * cleanup1.c: Remove unused "waitLock".
- (main): Fix implicit parameter cast.
-
- * cancel2.c (main): Fix implicit parameter cast.
-
- * cancel4.c (main): Fix implicit parameter cast.
-
- * cancel3.c (main): Fix implicit parameter cast.
-
- * GNUmakefile: Renamed from Makefile; Add missing
- cancel1 and cancel2 test targets.
-
- * Makefile: Converted for use with MS nmake.
-
-2000-08-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * ccl.bat: Add /nologo to remove extraneous output.
-
- * exception1.c (exceptionedThread): Init 'dummy';
- put expression into if condition to prevent optimising away;
- remove unused variable.
-
- * cancel4.c (mythread): Cast return value to avoid warnings.
-
- * cancel2.c (mythread): Missing #endif.
-
- * condvar9.c (mythread): Cast return value to avoid warnings.
-
- * condvar8.c (mythread): Cast return value to avoid warnings.
-
- * condvar7.c (mythread): Cast return value to avoid warnings.
-
- * cleanup3.c (mythread): Cast return value to avoid warnings.
-
- * cleanup2.c (mythread): Cast return value to avoid warnings.
-
- * cleanup1.c (mythread): Cast return value to avoid warnings.
-
- * condvar5.c (mythread): Cast return value to avoid warnings.
-
- * condvar3.c (mythread): Cast return value to avoid warnings.
-
- * condvar6.c (mythread): Cast return value to avoid warnings.
-
- * condvar4.c (mythread): Cast return value to avoid warnings.
-
-2000-08-05 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * cancel2.c: Use PtW32CatchAll macro if defined.
-
- * exception1.c: Use PtW32CatchAll macro if defined.
-
-2000-08-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * tsd1.c: Fix typecasts of &result [g++ is now very fussy].
-
- * test.h (assert): Return 0's explicitly to allay
- g++ errors.
-
- * join2.c: Add explicit typecasts.
-
- * join1.c: Add explicit typecasts.
-
- * join0.c: Add explicit typecasts.
-
- * eyal1.c: Add explicit typecasts.
-
- * count1.c (main): Add type cast to remove g++ parse warning
- [gcc-2.95.2 seems to have tightened up on this].
-
- * Makefile (GLANG): Use c++ explicitly.
- Remove MSVC sections (was commented out).
- Add target to generate cpp output.
-
-2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * runtest.bat: modified to work under W98.
-
- * runall.bat: Add new tests; modified to work under W98.
- It was ok under NT.
-
- * Makefile: Add new tests.
-
- * exception1.c: New; Test passing exceptions back to the
- application and retaining library internal exceptions.
-
- * join0.c: New; Test a single join.
-
-2000-01-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * cleanup1.c: New; Test cleanup handler executes (when thread is
- canceled).
-
- * cleanup2.c: New; Test cleanup handler executes (when thread is
- not canceled).
-
- * cleanup3.c: New; Test cleanup handler does not execute
- (when thread is not canceled).
-
-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.
-
- * cancel3.c: New; Test asynchronous cancelation.
-
- * context1.c: New; Test context switching method for async
- cancelation.
-
-1999-11-23 Ross Johnson <rpj@special.ise.canberra.edu.au>
-
- * test.h: Add header includes; include local header versions rather
- than system versions; rearrange the assert macro defines.
-
-1999-11-07 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * loadfree.c: New. Test loading and freeing the library (DLL).
-
-1999-10-30 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * cancel1.c: New. Test pthread_setcancelstate and
- pthread_setcanceltype functions.
- * eyal1.c (waste_time): Change calculation to avoid FP exception
- on Aplhas
- - Rich Peters <rpeters@micro-magic.com>
-
-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.
-
-Sep 16 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * rwlock6.c: New test.
-
-Sep 15 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * rwlock1.c: New test.
- * rwlock2.c: New test.
- * rwlock3.c: New test.
- * rwlock4.c: New test.
- * rwlock5.c: New test.
-
-Aug 22 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * runall.bat (join2): Add test.
-
-Aug 19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * join2.c: New test.
-
-Wed Aug 12 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * Makefile (LIBS): Add -L.
-
-Mon May 31 10:25:01 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * Makefile (GLANG): Add GCC language option.
-
-Sat May 29 23:29:04 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * runall.bat (condvar5): Add new test.
-
- * runall.bat (condvar6): Add new test.
-
- * Makefile (condvar5) : Add new test.
-
- * Makefile (condvar6) : Add new test.
-
- * condvar5.c: New test for pthread_cond_broadcast().
-
- * condvar6.c: New test for pthread_cond_broadcast().
-
-Sun Apr 4 12:04:28 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * tsd1.c (mythread): Change Sleep(0) to sched_yield().
- (sched.h): Include.
-
- * condvar3.c (mythread): Remove redundant Sleep().
-
- * runtest.bat: Re-organised to make more informative.
-
-Fri Mar 19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * *.bat: redirect unwanted output to nul:
-
- * runall.bat: new.
-
- * cancel1.c: new. Not part of suite yet.
-
-Mon Mar 15 00:17:55 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * mutex1.c: only test mutex init and destroy; add assertions.
-
- * count1.c: raise number of spawned threads to 60 (appears to
- be the limit under Win98).
-
-Sun Mar 14 21:31:02 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * test.h (assert): add assertion trace option.
- Use:
- "#define ASSERT_TRACE 1" to turn it on,
- "#define ASSERT_TRACE 0" to turn it off (default).
-
- * condvar3.c (main): add more assertions.
-
- * condvar4.c (main): add more assertions.
-
- * condvar1.c (main): add more assertions.
-
-Fri Mar 12 08:34:15 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * condvar4.c (cvthing): switch the order of the INITIALIZERs.
-
- * eyal1.c (main): Fix trylock loop; was not waiting for thread to lock
- the "started" mutex.
-
-Wed Mar 10 10:41:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * tryentercs.c: Apply typo patch from bje.
-
- * tryentercs2.c: Ditto.
-
-Sun Mar 7 10:41:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * Makefile (condvar3, condvar4): Add tests.
-
- * condvar4.c (General): Reduce to simple test case; prerequisite
- is condvar3.c; add description.
-
- * condvar3.c (General): Reduce to simple test case; prerequisite
- is condvar2.c; add description.
-
- * condvar2.c (General): Reduce to simple test case; prerequisite
- is condvar1.c; add description.
-
- * condvar1.c (General): Reduce to simple test case; add
- description.
-
- * Template.c (Comments): Add generic test detail.
-
-1999-02-23 Ross Johnson <rpj@ise.canberra.edu.au>
-
- * Template.c: Revamp.
-
- * condvar1.c: Add.
-
- * condvar2.c: Add.
-
- * Makefile: Add condvar1 condvar2 tests.
-
- * exit1.c, exit2.c, exit3.c: Cosmetic changes.
-
-1999-02-23 Ross Johnson <rpj@ise.canberra.edu.au>
-
- * Makefile: Some refinement.
-
- * *.c: More exhaustive checking through assertions; clean up;
- add some more tests.
-
- * Makefile: Now actually runs the tests.
-
- * tests.h: Define our own assert macro. The Mingw32
- version pops up a dialog but we want to run non-interactively.
-
- * equal1.c: use assert a little more directly so that it
- prints the actual call statement.
-
- * exit1.c: Modify to return 0 on success, 1 on failure.
-
-1999-02-22 Ross Johnson <rpj@ise.canberra.edu.au>
-
- * self2.c: Bring up to date.
-
- * self3.c: Ditto.
-
-1999-02-21 Ben Elliston <bje@cygnus.com>
-
- * README: Update.
-
- * Makefile: New file. Run all tests automatically. Primitive tests
- are run first; more complex tests are run last.
-
- * count1.c: New test. Validate the thread count.
-
- * exit2.c: Perform a simpler test.
-
- * exit3.c: New test. Replaces exit2.c, since exit2.c needs to
- perform simpler checking first.
-
- * create1.c: Update to use the new testsuite exiting convention.
-
- * equal1.c: Likewise.
-
- * mutex1.c: Likewise.
-
- * mutex2.c: Likewise.
-
- * once1.c: Likewise.
-
- * self2.c: Likewise.
-
- * self3.c: Likewise.
-
- * tsd1.c: Likewise.
-
-1999-02-20 Ross Johnson <rpj@ise.canberra.edu.au>
-
- * mutex2.c: Test static mutex initialisation.
-
- * test.h: New. Declares a table mapping error numbers to
- error names.
-
-1999-01-17 Ross Johnson <rpj@ise.canberra.edu.au>
-
- * runtest: New script to build and run a test in the tests directory.
-
-Wed Dec 30 11:22:44 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * tsd1.c: Re-written. See comments at start of file.
- * Template.c: New. Contains skeleton code and comment template
- intended to fully document the test.
-
-Fri Oct 16 17:59:49 1998 Ross Johnson <rpj@swan.canberra.edu.au>
-
- * tsd1.c (destroy_key): Add function. Change diagnostics.
-
-Thu Oct 15 17:42:37 1998 Ross Johnson <rpj@swan.canberra.edu.au>
-
- * tsd1.c (mythread): Fix some casts and add some message
- output. Fix inverted conditional.
-
-Mon Oct 12 02:12:29 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
-
- * tsd1.c: New. Test TSD using 1 key and 2 threads.
-
-1998-09-13 Ben Elliston <bje@cygnus.com>
-
- * eyal1.c: New file; contributed by Eyal Lebedinsky
- <eyal@eyal.emu.id.au>.
-
-1998-09-12 Ben Elliston <bje@cygnus.com>
-
- * exit2.c (func): Return a value.
- (main): Call the right thread entry function.
-
-1998-07-22 Ben Elliston <bje@cygnus.com>
-
- * exit2.c (main): Fix size of pthread_t array.
-
-1998-07-10 Ben Elliston <bje@cygnus.com>
-
- * exit2.c: New file; test pthread_exit() harder.
-
- * exit1.c: New file; test pthread_exit().
+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
+ scope and was more trouble than it was worth.
+ * cancel2.c: Ensure this test only runs for Structured or C++ EH.
+ * exit2.c: Shorten Sleep() time.
+ * exit3.c: Likewise.
+ * cancel1.c: Likewise.
+ * cancel3.c: Likewise.
+ * exception3.c: Likewise; make terminate routine consistent for all
+ build environments.
+
+2011-07-02 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * spin3.c: Unlock the unlocked spinlock now returns success.
+ * rwlock3.c: Join the thread to ensure it's completed.
+ * rwlock4.c: Likewise.
+ * rwlock5.c: Likewise.
+ * Makefile: Adjust prerequisites.
+ * GNUmakefile: Likewise.
+ * Bmakefile: Likewise.
+ * Wmakefile: Likewise.
+
+2011-07-02 Daniel Richard G. <skunk at iskunk dot org>
+
+ * *.[ch]: Cleanups around timeb struct, mainly centralising
+ macro definitions in test.h.
+ * Makefile: Fix annoying nmake warning.
+
+2011-06-30 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * sequence1.c: Fix loop overrun.
+
+2011-05-11 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * GNUmakefile (GCE-debug): New target; expects pthreadGCE2d.dll.
+
+2011-05-05 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * openmp1.c: Add missing test; used to comfirm that this
+ library works with libgomp; if this test produces a segfault
+ then try upgrading your version of libgomp/gcc; gcc version
+ 4.5.2 passes this test.
+
+2011-03-26 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * sequence1.c: New test for new pthread_getsequence_np().
+
+2011-03-24 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * mutex*.c: Include tests for robust mutexes wherever
+ appropriate.
+ * benchtest*.c: Include comparisons for robust mutexes.
+ * robust1.c: New test for robust mutex handling.
+ * robust2.c: Likewise.
+ * robust3.c: Likewise.
+ * robust4.c: Likewise.
+ * robust5.c: Likewise.
+ * GNUmakefile: Include new tests.
+ * Makefile: Likewise.
+ * Bmakefile: Likewise (not tested).
+ * Wmakefile: Likewise (not tested).
+
+2011-03-06 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * several (MINGW64): Cast and call fixups for 64 bit compatibility;
+ clean build via x86_64-w64-mingw32 cross toolchain on Linux
+ i686 targeting x86_64 win64.
+
+2011-03-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
+
+ * condvar3_2.c: abstime.tv_sec operation warning fixed.
+ * several: Use correct casting on pthread_join result arg
+ and associated declaration and usage; assumed that 64 bit
+ gcc gave some warnings for it.
+
+2011-02-28 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
+
+ * test.h: Define FTIME to be _ftime64_s or _ftime64 or _ftime
+ in that order of preference where supported.
+ * several: Replace calls to _ftime with the FTIME macro.
+
+2010-06-19 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
+
+ * Makefile (STATICRESULTS): Add all tests into suite for static
+ library.
+ * GNUmakefile (STATICTESTS): Likewise, except for openmp1.c which
+ has a DLL dependency.
+
+2010-02-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
+
+ * openmp1.c: New; for libgomp compatibility (OpenMP).
+ * barrier5.c: Rewrite after changes to barriers.
+ * barrier6.c: New.
+ * benchtest6.c: New; timing barriers.
+ * GNUMakefile: Update for new tests.
+ * Makefile: Ditto.
+ * BMakefile: Ditto.
+ * once3.c: Improve cancelation testing.
+ * stress1.c: Fix comment.
+
+2007-01-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
+
+ * context1.c: Include context.h from library sources and remove
+ x86 dependence in main().
+
+2005-06-12 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * stress1.c (millisecondsFromNow): Remove limit 0 <= millisecs < 1000;
+ now works for -INT_MAX <= millisecs <= INT_MAX; not needed for
+ stress1.c but should be general anyway.
+
+2005-05-18 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * reuse2.c (main): Must use a read with memory barrier semantics
+ when polling 'done' to force the cache into coherence on MP systems.
+
+2005-05-15 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * detach1.c: New test.
+ * join1.c: Reduce sleep times.
+ * join0.c: Remove MSVCRT conditional compile - join should always
+ return the thread exit code.
+ * join1.c: Likewise.
+ * join2.c: Likewise.
+ * join3.c: Likewise.
+
+2005-04-18 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * condvar3.c: Remove locks from around signalling calls - should not
+ be required for normal operation and only serve to mask deficiencies;
+ ensure that CV destruction is not premature after removing guards.
+ * condvar3_1.c: Likewise.
+ * condvar3_2.c: Likewise.
+ * condvar3_3.c: Likewise.
+ * condvar4.c: Likewise.
+ * condvar5.c: Likewise.
+ * condvar6.c: Likewise.
+ * condvar7.c: Likewise.
+ * condvar8.c: Likewise.
+ * condvar9.c: Likewise.
+
+2005-04-11 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * once4.c: New test; tries to test priority adjustments
+ in pthread_once(); set priority class to realtime so that
+ any failures can be seen.
+
+2005-04-06 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * cleanup0.c: Fix unguarded global variable accesses.
+ * cleanup1.c: Likewise.
+ * cleanup2.c: Likewise.
+ * cleanup3.c: Likewise.
+ * once2.c: Likewise.
+ * once3.c: Likewise.
+
+2005-04-01 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * GNUmakefile: Add target to test linking static link library.
+ * Makefile: Likewise.
+ * self1.c: Run process attach/detach routines when static linked.
+
+2005-03-16 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * mutex5.c: Prevent optimiser from removing asserts.
+
+2005-03-12 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * once3.c: New test.
+
+2005-03-08 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * once2.c: New test.
+
+2004-11-19 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * Bmakefile: New makefile for Borland.
+ * Makefile (DLL_VER): Added.
+ * GNUmakefile (DLL_VER): Added.
+ * Wmakefile (DLL_VER): Added.
+
+2004-10-29 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * semaphore4.c: New test.
+ * semaphore4t.c: New test.
+ * Debug.dsp (et al): Created MSVC Workspace project to aid debugging.
+ * All: Many tests have been modified to work with the new pthread
+ ID type; some other corrections were made after some library
+ functions were semantically strengthened. For example,
+ pthread_cond_destroy() no longer destroys a busy CV, which
+ required minor redesigns of some tests, including some where
+ the mutex associated with the CV was not locked during
+ signaling and broadcasting.
+
+2004-10-23 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * condvar3.c: Fixed mutex operations that were incorrectly
+ placed in relation to their condition variable operations.
+ The error became evident after sem_destroy() was rewritten
+ and conditions for destroing the semaphore were tightened.
+ As a result, pthread_cond_destroy() was not able to
+ destroy the cv queueing sempahore.
+ * condvar3_1.c: Likewise.
+ * condvar3_2.c: Likewise.
+ * condvar4.c: Likewise.
+ * condvar5.c: Likewise.
+ * condvar6.c: Likewise.
+ * condvar7.c: Likewise.
+ * condvar8.c: Likewise.
+ * condvar9.c: Likewise.
+
+2004-10-19 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * semaphore3.c: New test.
+
+2004-10-14 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * rwlock7.c (main): Tidy up statistics reporting; randomise
+ update accesses.
+ * rwlock8.c: New test.
+
+2004-09-08 Alexandre Girao <alexgirao@gmail.com>
+
+ * cancel7.c (main): Win98 wants a valid (non-NULL) location
+ for the last arg of _beginthreadex().
+ * cancel8.c (main): Likewise.
+ * exit4.c (main): Likewise.
+ * exit5.c (main): Likewise.
+
+2004-08-26 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * create3.c: New test.
+
+2004-06-21 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * mutex2r.c: New test.
+ * mutex2e.c: New test.
+ * mutex3r.c: New test.
+ * mutex3e.c: New test.
+ * mutex6s.c: New test.
+ * mutex6rs.c: New test.
+ * mutex6es.c: New test.
+
+2004-05-21 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * join3.c: New test.
+
+2004-05-16 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * condvar2.c (WIN32_WINNT): Define to avoid redefinition warning
+ from inclusion of implement.h.
+ * convar2_1.c: Likewise.
+ * condvar3_1.c: Likewise.
+ * condvar3_2.c: Likewise.
+ * context1.c: Likewise.
+ * sizes.c: Likewise.
+ * Makefile: Don't define _WIN32_WINNT on compiler command line.
+ * GNUmakefile: Likewise.
+ * priority1.c (main): Add column to output for actual win32
+ priority.
+
+2004-05-16 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * cancel9.c: New test.
+ * cancel3.c: Remove inappropriate conditional compilation;
+ GNU C version of test suite no longer quietly skips this test.
+ * cancel5.c: Likewise.
+ * GNUmakefile: Can now build individual test app using default
+ C version of library using 'make clean testname.c'.
+ * Makefile: Likewise for VC using 'nmake clean test testname.c'.
+
+2003-10-14 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * Wmakefile: New makefile for Watcom testing.
+
+2003-09-18 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * benchtest.h: Move old mutex code into benchlib.c.
+ * benchlib.c: New statically linked module to ensure that
+ bench apps don't inline the code and therefore have an unfair
+ advantage over the pthreads lib routines. Made little or no
+ difference.
+ * benchtest1.c: Minor change to avoid compiler warnings.
+ * benchtest5.c: Likewise.
+ * benchtest2.c: Fix misinformation in output report.
+ * README.BENCH: Add comments on results.
+
+2003-09-14 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * priority1.c: Reworked to comply with modified priority
+ management and provide additional output.
+ * priority2.c: Likewise.
+ * inherit1.c: Likewise.
+
+2003-09-03 Ross Johnson <rpj@callisto.canberra.edu.au>
+
+ * exit4.c: New test.
+ * exit5.c: New test.
+ * cancel7.c: New test.
+ * cancel8.c: New test.
+
+2003-08-13 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * reuse1.c: New test.
+ * reuse1.c: New test.
+ * valid1.c: New test.
+ * valid2.c: New test.
+ * kill1.c: New test.
+ * create2.c: Now included in test regime.
+
+2003-07-19 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * eyal1.c (waste_time): Make threads do more work to ensure that
+ all threads get to do some work.
+ * semaphore1.c: Make it clear that certain errors are expected.
+ * exception2.c (non_MSVC code sections): Change to include
+ C++ standard include file, i.e. change <new.h> to <exception>.
+ * exception3.c (non_MSVC code sections): Likewise; qualify std::
+ namespace entities where necessary.
+ * GNUmakefile: modified to work in the MsysDTK (newer MinGW)
+ environment; define CC as gcc or g++ as appropriate because
+ using gcc -x c++ doesn't link with required c++ libs by default,
+ but g++ does.
+
+2002-12-11 Ross Johnson <ross@special.ise.canberra.edu.au>
+
+ * mutex7e.c: Assert EBUSY return instead of EDEADLK.
+
+2002-06-03 Ross Johnson <rpj@digit.ise.canberra.edu.au>
+
+ * semaphore2.c: New test.
+
+2002-03-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * Makefile (CFLAGS): Changed /MT to /MD to link with
+ the correct library MSVCRT.LIB. Otherwise errno doesn't
+ work.
+
+2002-02-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * exception3.c: Correct recent change.
+
+ * semaphore1.c: New test.
+
+ * Makefile: Add rule to generate pre-processor output.
+
+2002-02-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * exception3.c (terminateFunction): For MSVC++, call
+ exit() rather than pthread_exit(). Add comments to explain
+ why.
+ * 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. Therefore
+ * term_func() should not call pthread_exit() if an
+ * an exception-using version of pthreads-win32 library
+ * is being used (i.e. either pthreadVCE or pthreadVSE).
+
+
+2002-02-23 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * rwlock2_t.c: New test.
+ * rwlock3_t.c: New test.
+ * rwlock4_t.c: New test.
+ * rwlock5_t.c: New test.
+ * rwlock6_t.c: New test.
+ * rwlock6_t2.c: New test.
+ * rwlock6.c (main): Swap thread and result variables
+ to correspond to actual thread functions.
+ * rwlock1.c: Change test description comment to correspond
+ to the actual test.
+
+ * condvar1_2.c: Loop over the test many times in the hope
+ of detecting any intermittent deadlocks. This is to
+ test a fixed problem in pthread_cond_destroy.c.
+
+ * spin4.c: Remove unused variable.
+
+2002-02-17 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * condvar1_1.c: New test.
+ * condvar1_2.c: New test.
+
+2002-02-07 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * delay1.c: New test.
+ * delay2.c: New test.
+ * exit4.c: New test.
+
+2002-02-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * mutex8: New test.
+ * mutex8n: New test.
+ * mutex8e: New test.
+ * mutex8r: New test.
+ * cancel6a: New test.
+ * cancel6d: New test.
+ * cleanup0.c: Add pragmas for inline optimisation control.
+ * cleanup1.c: Add pragmas for inline optimisation control.
+ * cleanup2.c: Add pragmas for inline optimisation control.
+ * cleanup3.c: Add pragmas for inline optimisation control.
+ * condvar7.c: Add pragmas for inline optimisation control.
+ * condvar8.c: Add pragmas for inline optimisation control.
+ * condvar9.c: Add pragmas for inline optimisation control.
+
+2002-01-30 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cleanup1.c (): Must be declared __cdecl when compiled
+ as C++ AND testing the standard C library version.
+
+2002-01-16 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * spin4.c (main): Fix renamed function call.
+
+2002-01-14 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * exception3.c (main): Shorten wait time.
+
+2002-01-09 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * mutex7.c: New test.
+ * mutex7n.c: New test.
+ * mutex7e.c: New test.
+ * mutex7r.c: New test.
+ * mutex6.c: Modified to avoid leaving the locked mutex
+ around on exit.
+
+2001-10-25 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * condvar2.c: Remove reference to cv->nWaitersUnblocked.
+ * condvar2_1.c: Likewise; lower NUMTHREADS from 60 to 30.
+ * condvar3_1.c: Likewise.
+ * condvar3_2.c: Likewise.
+ * count1.c: lower NUMTHREADS from 60 to 30.
+ * inherit1.c: Determine valid priority values and then
+ assert values returned by POSIX routines are the same.
+ * priority1.c: Likewise.
+ * priority2.c: Likewise.
+
+2001-07-12 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * barrier5.c: Assert that precisely one thread receives
+ PTHREAD_BARRIER_SERIAL_THREAD at each barrier.
+
+2001-07-09 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * barrier3.c: Fixed.
+ * barrier4.c: Fixed.
+ * barrier5.c: New; proves that all threads in the group
+ reaching the barrier wait and then resume together. Repeats the test
+ using groups of 1 to 16 threads. Each group of threads must negotiate
+ a large number of barriers (10000).
+ * spin4.c: Fixed.
+ * test.h (error_string): Modified the success (0) value.
+
+2001-07-07 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * spin3.c: Changed test and fixed.
+ * spin4.c: Fixed.
+ * barrier3.c: Fixed.
+ * barrier4.c: Fixed.
+
+2001-07-05 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * spin1.c: New; testing spinlocks.
+ * spin2.c: New; testing spinlocks.
+ * spin3.c: New; testing spinlocks.
+ * spin4.c: New; testing spinlocks.
+ * barrier1.c: New; testing barriers.
+ * barrier2.c: New; testing barriers.
+ * barrier3.c: New; testing barriers.
+ * barrier4.c: New; testing barriers.
+ * GNUmakefile: Add new tests.
+ * Makefile: Add new tests.
+
+2001-07-01 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * benchtest3.c: New; timing mutexes.
+ * benchtest4.c: New; time mutexes.
+ * condvar3_1.c: Fixed bug - Alexander Terekhov
+ * condvar3_3.c: New test.
+
+2001-06-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * priority1.c: New test.
+ * priority2.c: New test.
+ * inherit1.c: New test.
+ * benchtest1.c: New; timing mutexes.
+ * benchtest2.c: New; timing mutexes.
+ * mutex4.c: Modified to test all mutex types.
+
+2001-06-8 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * mutex5.c: Insert inert change to quell compiler warnings.
+ * condvar3_2.c: Remove unused variable.
+
+2001-06-3 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * condvar2_1.c: New test.
+ * condvar3_1.c: New test.
+ * condvar3_2.c: New test.
+
+2001-05-30 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * mutex1n.c: New test.
+ * mutex1e.c: New test.
+ * mutex1r.c: New test.
+ * mutex4.c: Now locks and unlocks a mutex.
+ * mutex5.c: New test.
+ * mutex6.c: New test.
+ * mutex6n.c: New test.
+ * mutex6e.c: New test.
+ * mutex6r.c: New test.
+ * Makefile: Added new tests; reorganised.
+ * GNUmakefile: Likewise.
+ * rwlock6.c: Fix to properly prove read-while-write locking
+ and single writer locking.
+
+2001-05-29 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * Makefile: Reorganisation.
+ * GNUmakefile: Likewise.
+ - Thomas Pfaff <tpfaff@gmx.net>
+
+ * exception1.c: Add stdio.h include to define fprintf and stderr
+ in non-exception C version of main().
+ * exception2.c: Likewise.
+ * exception3.c: Likewise.
+
+ * Makefile (rwlock7): Add new test.
+ * GNUmakefile (rwlock7): Add new test.
+ * rwlock7.c: New test.
+ * rwlock6.c: Changed to test that writer has priority.
+
+ * eyal1.c (main): Unlock each mutex_start lock before destroying
+ it.
+
+2000-12-29 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * GNUmakefile: Add mutex4 test; ensure libpthreadw32.a is
+ removed for "clean" target.
+ * Makefile: Add mutex4 test.
+
+ * exception3.c: Remove SEH code; automatically pass the test
+ under SEH (which is an N/A environment).
+
+ * mutex4.c: New test.
+
+ * eyal1.c (do_work_unit): Add a dummy "if" to force the
+ optimiser to retain code; reduce thread work loads.
+
+ * condvar8.c (main): Add an additional "assert" for debugging;
+ increase pthread_cond_signal timeout.
+
+2000-12-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * eyal1.c: Increase thread work loads.
+ * exception2.c: New test.
+ * exception3.c: New test.
+ * Makefile: Add new tests exception2.c and exception3.c.
+ * GNUmakefile: Likewise.
+
+2000-12-11 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cleanup3.c: Remove unused variable.
+ * cleanup2.c: Likewise.
+ * exception1.c: Throw an exception rather than use
+ a deliberate zero divide so that catch(...) will
+ handle it under Mingw32. Mingw32 now builds the
+ library correctly to pass all tests - see Thomas
+ Pfaff's detailed instructions re needed changes
+ to Mingw32 in the Pthreads-Win32 FAQ.
+
+2000-09-08 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cancel5.c: New; tests calling pthread_cancel()
+ from the main thread without first creating a
+ POSIX thread struct for the non-POSIX main thread
+ - this forces pthread_cancel() to create one via
+ pthread_self().
+ * Makefile (cancel5): Add new test.
+ * GNUmakefile (cancel5): Likewise.
+
+2000-08-17 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * create2.c: New; Test that pthread_t contains
+ the W32 HANDLE before it calls the thread routine
+ proper.
+
+2000-08-13 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * condvar3.c: Minor change to eliminate compiler
+ warning.
+
+ * condvar4.c: ditto.
+
+ * condvar5.c: ditto.
+
+ * condvar6.c: ditto.
+
+ * condvar7.c: ditto.
+
+ * condvar8.c: ditto.
+
+ * condvar9.c: ditto.
+
+ * exit1.c: Function needed return statement.
+
+ * cleanup1.c: Remove unnecessary printf arg.
+
+ * cleanup2.c: Fix cast.
+
+ * rwlock6.c: Fix casts.
+
+ * exception1.c (PtW32CatchAll): Had the wrong name;
+ fix casts.
+
+ * cancel3.c: Remove unused waitLock variable.
+
+ * GNUmakefile: Change library/dll naming; add new tests;
+ general minor changes.
+
+ * Makefile: Change library/dll naming; add targets for
+ testing each of the two VC++ EH scheme versions;
+ default target now issues help message; compile warnings
+ now interpreted as errors to stop the make; add new
+ tests; restructure to remove prerequisites needed
+ otherwise.
+
+ * README: Updated.
+
+
+2000-08-10 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * eyal1.c (main): Change implicit cast to explicit
+ cast when passing "print_server" function pointer;
+ G++ no longer allows implicit func parameter casts.
+
+ * cleanup1.c: Remove unused "waitLock".
+ (main): Fix implicit parameter cast.
+
+ * cancel2.c (main): Fix implicit parameter cast.
+
+ * cancel4.c (main): Fix implicit parameter cast.
+
+ * cancel3.c (main): Fix implicit parameter cast.
+
+ * GNUmakefile: Renamed from Makefile; Add missing
+ cancel1 and cancel2 test targets.
+
+ * Makefile: Converted for use with MS nmake.
+
+2000-08-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * ccl.bat: Add /nologo to remove extraneous output.
+
+ * exception1.c (exceptionedThread): Init 'dummy';
+ put expression into if condition to prevent optimising away;
+ remove unused variable.
+
+ * cancel4.c (mythread): Cast return value to avoid warnings.
+
+ * cancel2.c (mythread): Missing #endif.
+
+ * condvar9.c (mythread): Cast return value to avoid warnings.
+
+ * condvar8.c (mythread): Cast return value to avoid warnings.
+
+ * condvar7.c (mythread): Cast return value to avoid warnings.
+
+ * cleanup3.c (mythread): Cast return value to avoid warnings.
+
+ * cleanup2.c (mythread): Cast return value to avoid warnings.
+
+ * cleanup1.c (mythread): Cast return value to avoid warnings.
+
+ * condvar5.c (mythread): Cast return value to avoid warnings.
+
+ * condvar3.c (mythread): Cast return value to avoid warnings.
+
+ * condvar6.c (mythread): Cast return value to avoid warnings.
+
+ * condvar4.c (mythread): Cast return value to avoid warnings.
+
+2000-08-05 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cancel2.c: Use PtW32CatchAll macro if defined.
+
+ * exception1.c: Use PtW32CatchAll macro if defined.
+
+2000-08-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * tsd1.c: Fix typecasts of &result [g++ is now very fussy].
+
+ * test.h (assert): Return 0's explicitly to allay
+ g++ errors.
+
+ * join2.c: Add explicit typecasts.
+
+ * join1.c: Add explicit typecasts.
+
+ * join0.c: Add explicit typecasts.
+
+ * eyal1.c: Add explicit typecasts.
+
+ * count1.c (main): Add type cast to remove g++ parse warning
+ [gcc-2.95.2 seems to have tightened up on this].
+
+ * Makefile (GLANG): Use c++ explicitly.
+ Remove MSVC sections (was commented out).
+ Add target to generate cpp output.
+
+2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * runtest.bat: modified to work under W98.
+
+ * runall.bat: Add new tests; modified to work under W98.
+ It was ok under NT.
+
+ * Makefile: Add new tests.
+
+ * exception1.c: New; Test passing exceptions back to the
+ application and retaining library internal exceptions.
+
+ * join0.c: New; Test a single join.
+
+2000-01-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cleanup1.c: New; Test cleanup handler executes (when thread is
+ canceled).
+
+ * cleanup2.c: New; Test cleanup handler executes (when thread is
+ not canceled).
+
+ * cleanup3.c: New; Test cleanup handler does not execute
+ (when thread is not canceled).
+
+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.
+
+ * cancel3.c: New; Test asynchronous cancelation.
+
+ * context1.c: New; Test context switching method for async
+ cancelation.
+
+1999-11-23 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * test.h: Add header includes; include local header versions rather
+ than system versions; rearrange the assert macro defines.
+
+1999-11-07 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * loadfree.c: New. Test loading and freeing the library (DLL).
+
+1999-10-30 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * cancel1.c: New. Test pthread_setcancelstate and
+ pthread_setcanceltype functions.
+ * eyal1.c (waste_time): Change calculation to avoid FP exception
+ on Aplhas
+ - Rich Peters <rpeters@micro-magic.com>
+
+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.
+
+Sep 16 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * rwlock6.c: New test.
+
+Sep 15 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * rwlock1.c: New test.
+ * rwlock2.c: New test.
+ * rwlock3.c: New test.
+ * rwlock4.c: New test.
+ * rwlock5.c: New test.
+
+Aug 22 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * runall.bat (join2): Add test.
+
+Aug 19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * join2.c: New test.
+
+Wed Aug 12 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * Makefile (LIBS): Add -L.
+
+Mon May 31 10:25:01 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * Makefile (GLANG): Add GCC language option.
+
+Sat May 29 23:29:04 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * runall.bat (condvar5): Add new test.
+
+ * runall.bat (condvar6): Add new test.
+
+ * Makefile (condvar5) : Add new test.
+
+ * Makefile (condvar6) : Add new test.
+
+ * condvar5.c: New test for pthread_cond_broadcast().
+
+ * condvar6.c: New test for pthread_cond_broadcast().
+
+Sun Apr 4 12:04:28 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * tsd1.c (mythread): Change Sleep(0) to sched_yield().
+ (sched.h): Include.
+
+ * condvar3.c (mythread): Remove redundant Sleep().
+
+ * runtest.bat: Re-organised to make more informative.
+
+Fri Mar 19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * *.bat: redirect unwanted output to nul:
+
+ * runall.bat: new.
+
+ * cancel1.c: new. Not part of suite yet.
+
+Mon Mar 15 00:17:55 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * mutex1.c: only test mutex init and destroy; add assertions.
+
+ * count1.c: raise number of spawned threads to 60 (appears to
+ be the limit under Win98).
+
+Sun Mar 14 21:31:02 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * test.h (assert): add assertion trace option.
+ Use:
+ "#define ASSERT_TRACE 1" to turn it on,
+ "#define ASSERT_TRACE 0" to turn it off (default).
+
+ * condvar3.c (main): add more assertions.
+
+ * condvar4.c (main): add more assertions.
+
+ * condvar1.c (main): add more assertions.
+
+Fri Mar 12 08:34:15 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar4.c (cvthing): switch the order of the INITIALIZERs.
+
+ * eyal1.c (main): Fix trylock loop; was not waiting for thread to lock
+ the "started" mutex.
+
+Wed Mar 10 10:41:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * tryentercs.c: Apply typo patch from bje.
+
+ * tryentercs2.c: Ditto.
+
+Sun Mar 7 10:41:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * Makefile (condvar3, condvar4): Add tests.
+
+ * condvar4.c (General): Reduce to simple test case; prerequisite
+ is condvar3.c; add description.
+
+ * condvar3.c (General): Reduce to simple test case; prerequisite
+ is condvar2.c; add description.
+
+ * condvar2.c (General): Reduce to simple test case; prerequisite
+ is condvar1.c; add description.
+
+ * condvar1.c (General): Reduce to simple test case; add
+ description.
+
+ * Template.c (Comments): Add generic test detail.
+
+1999-02-23 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * Template.c: Revamp.
+
+ * condvar1.c: Add.
+
+ * condvar2.c: Add.
+
+ * Makefile: Add condvar1 condvar2 tests.
+
+ * exit1.c, exit2.c, exit3.c: Cosmetic changes.
+
+1999-02-23 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * Makefile: Some refinement.
+
+ * *.c: More exhaustive checking through assertions; clean up;
+ add some more tests.
+
+ * Makefile: Now actually runs the tests.
+
+ * tests.h: Define our own assert macro. The Mingw32
+ version pops up a dialog but we want to run non-interactively.
+
+ * equal1.c: use assert a little more directly so that it
+ prints the actual call statement.
+
+ * exit1.c: Modify to return 0 on success, 1 on failure.
+
+1999-02-22 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * self2.c: Bring up to date.
+
+ * self3.c: Ditto.
+
+1999-02-21 Ben Elliston <bje@cygnus.com>
+
+ * README: Update.
+
+ * Makefile: New file. Run all tests automatically. Primitive tests
+ are run first; more complex tests are run last.
+
+ * count1.c: New test. Validate the thread count.
+
+ * exit2.c: Perform a simpler test.
+
+ * exit3.c: New test. Replaces exit2.c, since exit2.c needs to
+ perform simpler checking first.
+
+ * create1.c: Update to use the new testsuite exiting convention.
+
+ * equal1.c: Likewise.
+
+ * mutex1.c: Likewise.
+
+ * mutex2.c: Likewise.
+
+ * once1.c: Likewise.
+
+ * self2.c: Likewise.
+
+ * self3.c: Likewise.
+
+ * tsd1.c: Likewise.
+
+1999-02-20 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * mutex2.c: Test static mutex initialisation.
+
+ * test.h: New. Declares a table mapping error numbers to
+ error names.
+
+1999-01-17 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * runtest: New script to build and run a test in the tests directory.
+
+Wed Dec 30 11:22:44 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * tsd1.c: Re-written. See comments at start of file.
+ * Template.c: New. Contains skeleton code and comment template
+ intended to fully document the test.
+
+Fri Oct 16 17:59:49 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * tsd1.c (destroy_key): Add function. Change diagnostics.
+
+Thu Oct 15 17:42:37 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * tsd1.c (mythread): Fix some casts and add some message
+ output. Fix inverted conditional.
+
+Mon Oct 12 02:12:29 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * tsd1.c: New. Test TSD using 1 key and 2 threads.
+
+1998-09-13 Ben Elliston <bje@cygnus.com>
+
+ * eyal1.c: New file; contributed by Eyal Lebedinsky
+ <eyal@eyal.emu.id.au>.
+
+1998-09-12 Ben Elliston <bje@cygnus.com>
+
+ * exit2.c (func): Return a value.
+ (main): Call the right thread entry function.
+
+1998-07-22 Ben Elliston <bje@cygnus.com>
+
+ * exit2.c (main): Fix size of pthread_t array.
+
+1998-07-10 Ben Elliston <bje@cygnus.com>
+
+ * exit2.c: New file; test pthread_exit() harder.
+
+ * exit1.c: New file; test pthread_exit().
diff --git a/pthreads/tests/GNUmakefile b/pthreads/tests/GNUmakefile
index 4c9ed765b..355c27e8c 100644
--- a/pthreads/tests/GNUmakefile
+++ b/pthreads/tests/GNUmakefile
@@ -1,408 +1,442 @@
-# Makefile for the pthreads test suite.
-# If all of the .pass files can be created, the test suite has passed.
-#
-# --------------------------------------------------------------------------
-#
-# 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
-#
-
-DLL_VER = 2
-
-CP = cp -f
-MV = mv -f
-RM = rm -f
-CAT = cat
-#CP = copy
-#MV = rename
-#RM = erase
-#CAT = type
-MKDIR = mkdir
-TOUCH = echo Passed >
-ECHO = @echo
-MAKE = make -k
-
-#
-# Mingw32
-#
-XXCFLAGS =
-XXLIBS = -lws2_32 -lgomp
-#CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
-CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
-BUILD_DIR = ..
-INCLUDES = -I.
-
-
-TEST = GC
-
-# Default lib version
-GCX = $(TEST)$(DLL_VER)
-
-# Files we need to run the tests
-# - paths are relative to pthreads build dir.
-HDR = pthread.h semaphore.h sched.h
-LIB = libpthread$(GCX).a
-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 \
- 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 \
- 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 create3 stress1
-
-STRESSTESTS = \
- stress1
-
-BENCHTESTS = \
- benchtest1 benchtest2 benchtest3 benchtest4 benchtest5 benchtest6
-
-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 \
- 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 \
- 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 create3 stress1
-
-PASSES = $(TESTS:%=%.pass)
-BENCHRESULTS = $(BENCHTESTS:%=%.bench)
-STRESSRESULTS = $(STRESSTESTS:%=%.pass)
-STATICRESULTS = $(STATICTESTS:%=%.pass)
-
-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)"
-
-all:
- @ $(MAKE) clean GC
- @ $(MAKE) clean GCX
- @ $(MAKE) clean GCE
-
-GC:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-fopenmp -D__CLEANUP_C" all-pass
-
-GCE:
- $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_CXX" all-pass
-
-GCX:
- $(MAKE) TEST=GC CC=g++ XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_C" all-pass
-
-GC-bench:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
-
-GCE-bench:
- $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
-
-GC-debug:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-fopenmp -D__CLEANUP_C" DLL_VER="$(DLL_VER)d" all-pass
-
-GC-static:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" XXLIBS="-lws2_32" DLL="" all-static
-
-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=gcc XXCFLAGS="-D__CLEANUP_C" XXLIBS="" all-stress
-
-GCE-stress:
- $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="" all-stress
-
-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:
-benchtest6.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
-cancel2_1.pass: cancel2.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: cancel2.pass
-count1.pass: join1.pass
-create1.pass: mutex2.pass
-create2.pass: create1.pass
-create3.pass:
-delay1.pass: cancel2.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
-rwlock1.pass: condvar6.pass
-rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.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
-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) $@
-
-%.pass: %.exe
- @ $(ECHO) Running $*
- $*
- @ $(ECHO) Passed
- @ $(TOUCH) $@
-
-%.bench: $(LIB) $(DLL) $(HDR) $(QAPC) $(XXLIBS) %.exe
- @ $(ECHO) Running $*
- $*
- @ $(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)
-
-%.pre: %.c $(HDR)
- @ $(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
-
-%.s: %.c $(HDR)
- @ $(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
-
-$(COPYFILES):
- @ $(ECHO) Copying $(BUILD_DIR)/$@
- @ $(CP) $(BUILD_DIR)/$@ .
-
-benchlib.o: benchlib.c
- @ $(ECHO) Compiling $@
- @ $(ECHO) $(CC) -c $(CFLAGS) $< $(INCLUDES)
- @ $(CC) -c $(CFLAGS) $< $(INCLUDES)
-
-pthread.dll: $(DLL)
- @ $(CP) $(DLL) $@
-
-clean:
- - $(RM) *.dll
- - $(RM) *.lib
- - $(RM) pthread.h
- - $(RM) semaphore.h
- - $(RM) sched.h
- - $(RM) *.a
- - $(RM) *.e
- - $(RM) *.i
- - $(RM) *.o
- - $(RM) *.so
- - $(RM) *.obj
- - $(RM) *.pdb
- - $(RM) *.exe
- - $(RM) *.pass
- - $(RM) *.bench
- - $(RM) *.static
- - $(RM) *.log
+# Makefile for the pthreads test suite.
+# If all of the .pass files can be created, the test suite has passed.
+#
+# --------------------------------------------------------------------------
+#
+# 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
+#
+
+DLL_VER = 2
+
+CP = cp -f
+MV = mv -f
+RM = rm -f
+CAT = cat
+MKDIR = mkdir
+TOUCH = echo Passed >
+ECHO = @echo
+MAKE = make -k
+
+# For cross compiling use e.g.
+# # make CROSS=i386-mingw32msvc- clean GC
+CROSS =
+
+AR = $(CROSS)ar
+DLLTOOL = $(CROSS)dlltool
+CC = $(CROSS)gcc
+CXX = $(CROSS)g++
+RANLIB = $(CROSS)ranlib
+
+#
+# Mingw32
+#
+XXCFLAGS =
+XXLIBS = -lws2_32 -lgomp
+OPT = -O3
+DOPT = -g -O0
+#CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
+CFLAGS = ${OPT} -UNDEBUG -Wall $(XXCFLAGS)
+BUILD_DIR = ..
+INCLUDES = -I.
+
+.INTERMEDIATE: %.exe %.pass
+.SECONDARY: %.exe %.pass
+.PRECIOUS: %.exe %.pass
+
+TEST = GC
+
+# Default lib version
+GCX = $(TEST)$(DLL_VER)
+
+# Files we need to run the tests
+# - paths are relative to pthreads build dir.
+HDR = pthread.h semaphore.h sched.h
+LIB = libpthread$(GCX).a
+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)
+BENCHRESULTS = $(BENCHTESTS:%=%.bench)
+STRESSRESULTS = $(STRESSTESTS:%=%.pass)
+STATICRESULTS = $(STATICTESTS:%=%.pass)
+
+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
+
+GC:
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-pass
+
+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
+
+GC-bench:
+ $(MAKE) TEST=GC 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-debug:
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
+
+GCE-debug:
+ $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -D__CLEANUP_CXX" OPT="${DOPT}" DLL_VER="$(DLL_VER)d" all-pass
+
+GC-bench-debug:
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" OPT="${OPT}" DLL_VER="$(DLL_VER)d" all-bench
+
+GC-static:
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" XXLIBS="-lws2_32" DLL="" all-static
+
+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
+
+GCE-stress:
+ $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="" all-stress
+
+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) $@
+
+%.pass: %.exe
+ @ $(ECHO) Running $*
+ ./$*
+ @ $(ECHO) Passed
+ @ $(TOUCH) $@
+
+%.bench: $(LIB) $(DLL) $(HDR) $(QAPC) $(XXLIBS) %.exe
+ @ $(ECHO) Running $*
+ ./$*
+ @ $(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)
+
+%.pre: %.c $(HDR)
+ @ $(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
+
+%.s: %.c $(HDR)
+ @ $(ECHO) Compiling $@
+ @ $(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
+
+$(COPYFILES):
+ @ $(ECHO) Copying $(BUILD_DIR)/$@
+ @ $(CP) $(BUILD_DIR)/$@ .
+
+benchlib.o: benchlib.c
+ @ $(ECHO) Compiling $@
+ @ $(ECHO) $(CC) -c $(CFLAGS) $< $(INCLUDES)
+ @ $(CC) -c $(CFLAGS) $< $(INCLUDES)
+
+pthread.dll: $(DLL)
+ @ $(CP) $(DLL) $@
+
+clean:
+ - $(RM) *.dll
+ - $(RM) *.lib
+ - $(RM) pthread.h
+ - $(RM) semaphore.h
+ - $(RM) sched.h
+ - $(RM) *.a
+ - $(RM) *.e
+ - $(RM) *.i
+ - $(RM) *.o
+ - $(RM) *.s
+ - $(RM) *.so
+ - $(RM) *.obj
+ - $(RM) *.pdb
+ - $(RM) *.exe
+ - $(RM) *.pass
+ - $(RM) *.bench
+ - $(RM) *.static
+ - $(RM) *.log
diff --git a/pthreads/tests/Makefile b/pthreads/tests/Makefile
index 8c89349c1..9b0ca3094 100644
--- a/pthreads/tests/Makefile
+++ b/pthreads/tests/Makefile
@@ -1,442 +1,449 @@
-# Makefile for the pthreads test suite.
-# If all of the .pass files can be created, the test suite has passed.
-#
-# --------------------------------------------------------------------------
-#
-# 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
-#
-
-DLL_VER = 2
-
-CP = copy
-RM = erase
-CAT = type
-MKDIR = mkdir
-TOUCH = echo Passed >
-ECHO = @echo
-
-# The next path is relative to $BUILD_DIR
-QAPC = ..\QueueUserAPCEx\User\quserex.dll
-
-CPHDR = pthread.h semaphore.h sched.h
-
-OPTIM = /O2 /Ob0
-
-XXLIBS = ws2_32.lib
-
-# C++ Exceptions
-VCEFLAGS = /GX /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
-VCELIB = pthreadVCE$(DLL_VER).lib
-VCEDLL = pthreadVCE$(DLL_VER).dll
-# Structured Exceptions
-VSEFLAGS = /D__CLEANUP_SEH
-VSELIB = pthreadVSE$(DLL_VER).lib
-VSEDLL = pthreadVSE$(DLL_VER).dll
-# C cleanup code
-VCFLAGS = /D__CLEANUP_C
-VCLIB = pthreadVC$(DLL_VER).lib
-VCDLL = pthreadVC$(DLL_VER).dll
-# C++ Exceptions in application - using VC version of pthreads dll
-VCXFLAGS = /GX /TP /D__CLEANUP_C
-
-# Defaults
-CPLIB = $(VCLIB)
-CPDLL = $(VCDLL)
-
-CFLAGS= $(OPTIM) /W3 /MD /nologo /Yd /Zi
-LFLAGS= /INCREMENTAL:NO
-INCLUDES=-I.
-BUILD_DIR=..
-
-COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
-
-TEST =
-EHFLAGS =
-
-# If a test case returns a non-zero exit code to the shell, make will
-# stop.
-
-PASSES= sizes.pass 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 \
- 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 \
- 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 create3.pass stress1.pass
-
-BENCHRESULTS = \
- benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench \
- benchtest6.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 \
- 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 \
- 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 create3.pass stress1.pass
-
-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:
- @ nmake clean VC
- @ nmake clean VCX
- @ nmake clean VCE
- @ nmake clean VSE
- @ nmake clean VC-bench
- @ nmake 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
-
-$(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
-
-VC:
- @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" tests
-
-VCE:
- @ nmake TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" tests
-
-VSE:
- @ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests
-
-VCX:
- @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" tests
-
-VC-bench:
- @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" XXLIBS="benchlib.o" benchtests
-
-VCE-bench:
- @ nmake TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" XXLIBS="benchlib.o" benchtests
-
-VSE-bench:
- @ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" XXLIBS="benchlib.o" benchtests
-
-VCX-bench:
- @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests
-
-VC-stress:
- @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" stresstests
-
-VCE-stress:
- @ nmake TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" stresstests
-
-VSE-stress:
- @ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" stresstests
-
-VCX-stress:
- @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" stresstests
-
-VC-static:
- @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" statictests
-
-.c.exe:
- @ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
- @ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
-
-.c.o:
- @ $(ECHO) $(CC) $(EHFLAGS) /c $(CFLAGS) $(INCLUDES) $< /Fo$@
- @ $(CC) $(EHFLAGS) $(CFLAGS) /c $(INCLUDES) $< /Fo$@
-
-.c.i:
- @ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
-
-$(COPYFILES):
- @ $(ECHO) Copying $(BUILD_DIR)\$@
- @ $(CP) $(BUILD_DIR)\$@ .
-
-pthread.dll: $(CPDLL)
- @ $(CP) $(CPDLL) pthread.dll
- @ $(CP) $(CPLIB) pthread.lib
-
-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:
-benchtest6.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: cancel2.pass
-count1.pass: join1.pass
-create1.pass: mutex2.pass
-create2.pass: create1.pass
-create3.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
-rwlock1.pass: condvar6.pass
-rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.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
-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
+# Makefile for the pthreads test suite.
+# If all of the .pass files can be created, the test suite has passed.
+#
+# --------------------------------------------------------------------------
+#
+# 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
+#
+
+DLL_VER = 2
+
+CP = copy
+RM = erase
+CAT = type
+MKDIR = mkdir
+TOUCH = echo Passed >
+ECHO = echo
+
+# The next path is relative to $BUILD_DIR
+QAPC = # ..\QueueUserAPCEx\User\quserex.dll
+
+CPHDR = pthread.h semaphore.h sched.h
+
+OPTIM = /O2 /Ob0
+
+XXLIBS = ws2_32.lib
+
+# C++ Exceptions
+VCEFLAGS = /EHsc /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
+VCELIB = pthreadVCE$(DLL_VER).lib
+VCEDLL = pthreadVCE$(DLL_VER).dll
+# Structured Exceptions
+VSEFLAGS = /D__CLEANUP_SEH
+VSELIB = pthreadVSE$(DLL_VER).lib
+VSEDLL = pthreadVSE$(DLL_VER).dll
+# C cleanup code
+VCFLAGS = /D__CLEANUP_C
+VCLIB = pthreadVC$(DLL_VER).lib
+VCDLL = pthreadVC$(DLL_VER).dll
+# C++ Exceptions in application - using VC version of pthreads dll
+VCXFLAGS = /EHsc /TP /D__CLEANUP_C
+
+# Defaults
+CPLIB = $(VCLIB)
+CPDLL = $(VCDLL)
+
+CFLAGS= $(OPTIM) /W3 /MD /nologo /Z7
+LFLAGS= /INCREMENTAL:NO
+INCLUDES=-I.
+BUILD_DIR=..
+
+COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
+
+TEST =
+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
+
+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
+
+VC:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" tests
+
+VCE:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" tests
+
+VSE:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests
+
+VCX:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" tests
+
+VC-bench:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" XXLIBS="benchlib.o" benchtests
+
+VCE-bench:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" XXLIBS="benchlib.o" benchtests
+
+VSE-bench:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" XXLIBS="benchlib.o" benchtests
+
+VCX-bench:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests
+
+VC-stress:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" stresstests
+
+VCE-stress:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" stresstests
+
+VSE-stress:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" stresstests
+
+VCX-stress:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" stresstests
+
+VC-static:
+ @ $(MAKE) /E TEST="$@" CPLIB="$(VCLIB)" CPDLL="" EHFLAGS="$(VCFLAGS) /DPTW32_STATIC_LIB" statictests
+
+.c.exe:
+ @ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
+ @ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
+
+.c.o:
+ @ $(ECHO) $(CC) $(EHFLAGS) /c $(CFLAGS) $(INCLUDES) $< /Fo$@
+ @ $(CC) $(EHFLAGS) $(CFLAGS) /c $(INCLUDES) $< /Fo$@
+
+.c.i:
+ @ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
+
+$(COPYFILES):
+ @ $(ECHO) Copying $(BUILD_DIR)\$@
+ @ $(CP) $(BUILD_DIR)\$@ .
+
+pthread.dll: $(CPDLL)
+ @ $(CP) $(CPDLL) pthread.dll
+ @ $(CP) $(CPLIB) pthread.lib
+
+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
diff --git a/pthreads/tests/SIZES.GC b/pthreads/tests/SIZES.GC
index 5c5df2952..d5ddf363f 100644
--- a/pthreads/tests/SIZES.GC
+++ b/pthreads/tests/SIZES.GC
@@ -1,21 +1,21 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t 8
- ptw32_thread_t 140
- pthread_attr_t_ 28
- sem_t_ 12
- pthread_mutex_t_ 24
- pthread_mutexattr_t_ 8
- 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
--------------------------------
+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
index 0db5de0b4..709114d52 100644
--- a/pthreads/tests/SIZES.GCE
+++ b/pthreads/tests/SIZES.GCE
@@ -1,21 +1,21 @@
Sizes of pthreads-win32 structs
-------------------------------
- pthread_t 8
- ptw32_thread_t 76
+ pthread_t 8
+ ptw32_thread_t 96
pthread_attr_t_ 28
- sem_t_ 12
- pthread_mutex_t_ 24
- pthread_mutexattr_t_ 8
+ sem_t_ 12
+ pthread_mutex_t_ 28
+ pthread_mutexattr_t_ 12
pthread_spinlock_t_ 8
- pthread_barrier_t_ 36
+ 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
+ pthread_once_t_ 16
ptw32_cleanup_t 12
- ptw32_mcs_node_t_ 16
+ ptw32_mcs_node_t_ 16
sched_param 4
-------------------------------
diff --git a/pthreads/tests/SIZES.VC b/pthreads/tests/SIZES.VC
index ae09a84e6..d5ddf363f 100644
--- a/pthreads/tests/SIZES.VC
+++ b/pthreads/tests/SIZES.VC
@@ -1,20 +1,21 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t_ 124
- pthread_attr_t_ 28
- sem_t_ 4
- pthread_mutex_t_ 44
- pthread_mutexattr_t_ 8
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 24
- 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_ 8
- ptw32_cleanup_t 12
- sched_param 4
--------------------------------
-
+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
index edc642719..709114d52 100644
--- a/pthreads/tests/SIZES.VCE
+++ b/pthreads/tests/SIZES.VCE
@@ -1,19 +1,21 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t_ 68
- pthread_attr_t_ 28
- sem_t_ 4
- pthread_mutex_t_ 44
- pthread_mutexattr_t_ 8
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 24
- 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_ 8
- ptw32_cleanup_t 12
- sched_param 4
--------------------------------
+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
index edc642719..709114d52 100644
--- a/pthreads/tests/SIZES.VSE
+++ b/pthreads/tests/SIZES.VSE
@@ -1,19 +1,21 @@
-Sizes of pthreads-win32 structs
--------------------------------
- pthread_t_ 68
- pthread_attr_t_ 28
- sem_t_ 4
- pthread_mutex_t_ 44
- pthread_mutexattr_t_ 8
- pthread_spinlock_t_ 8
- pthread_barrier_t_ 24
- 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_ 8
- ptw32_cleanup_t 12
- sched_param 4
--------------------------------
+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 6525c1ed6..2b37c4691 100644
--- a/pthreads/tests/Wmakefile
+++ b/pthreads/tests/Wmakefile
@@ -1,349 +1,355 @@
-# Watcom makefile for the pthreads test suite.
-# If all of the .pass files can be created, the test suite has passed.
-#
-# --------------------------------------------------------------------------
-#
-# 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
-#
-
-
-DLL_VER = 2
-
-.EXTENSIONS:
-
-.EXTENSIONS: .pass .exe .obj .i .c
-
-CP = copy
-RM = erase
-CAT = type
-MKDIR = mkdir
-TOUCH = echo Passed >
-ECHO = @echo
-
-CPHDR = pthread.h semaphore.h sched.h
-
-OPTIM = -od
-
-XXLIBS =
-
-# C++ Exceptions
-WCEFLAGS = -xs -dPtW32NoCatchWarn -d__CLEANUP_CXX
-WCELIB = pthreadWCE$(DLL_VER).lib
-WCEDLL = pthreadWCE$(DLL_VER).dll
-# C cleanup code
-WCFLAGS = -d__CLEANUP_C
-WCLIB = pthreadWC$(DLL_VER).lib
-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
-
-LFLAGS=
-INCLUDES= -i=.
-BUILD_DIR=..
-
-# The next path is relative to $BUILD_DIR
-QAPC = ..\QueueUserAPCEx\User\quserex.dll
-
-COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
-
-TEST =
-EHFLAGS =
-
-# If a test case returns a non-zero exit code to the shell, make will
-# stop.
-
-PASSES = sizes.pass 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 &
- kill1.pass valid1.pass valid2.pass &
- exit2.pass exit3.pass exit4 exit5 &
- 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 &
- count1.pass &
- once1.pass once2.pass once3.pass once4.pass tsd1.pass &
- self2.pass &
- cancel1.pass cancel2.pass &
- semaphore4.pass semaphore4t.pass semaphore5.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 cancel8 &
- cleanup0.pass cleanup1.pass cleanup2.pass cleanup3.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 create3.pass stress1.pass
-
-BENCHRESULTS = &
- benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench
-
-help: .SYMBOLIC
- @ $(ECHO) Run one of the following command lines:
- @ $(ECHO) wmake /f Wmakefile clean WC (to test using WC dll with wcc386 (no EH) applications)
- @ $(ECHO) wmake /f Wmakefile clean WCX (to test using WC dll with wpp386 (EH) applications)
- @ $(ECHO) wmake /f Wmakefile clean WCE (to test using the WCE dll with wpp386 EH applications)
- @ $(ECHO) wmake /f Wmakefile clean WC-bench (to benchtest using WC dll with C bench app)
- @ $(ECHO) wmake /f Wmakefile clean WCX-bench (to benchtest using WC dll with C++ bench app)
- @ $(ECHO) wmake /f Wmakefile clean WCE-bench (to benchtest using WCE dll with C++ bench app)
-
-all: .SYMBOLIC
- @ wmake /f Wmakefile clean WC
- @ wmake /f Wmakefile clean WCX
- @ wmake /f Wmakefile clean WCE
- @ wmake /f Wmakefile clean WSE
- @ wmake /f Wmakefile clean WC-bench
-
-tests: $(CPLIB) $(CPDLL) $(CPHDR) $(PASSES) .SYMBOLIC
- @ $(ECHO) ALL TESTS PASSED! Congratulations!
-
-benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(XXLIBS) $(BENCHRESULTS) .SYMBOLIC
- @ $(ECHO) ALL BENCH TESTS DONE.
-
-$(BENCHRESULTS): ($[*).exe
- @ $(ECHO) ... Running $(TEST) benchtest: ($[*).exe
- @ .\($[*).exe
- @ $(ECHO) ...... Done
- @ $(TOUCH) ($[*).bench
-
-WCE: .SYMBOLIC
- @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCELIB)" CPDLL="$(WCEDLL)" EHFLAGS="$(WCEFLAGS)" tests
-
-WC: .SYMBOLIC
- @ wmake /f Wmakefile CC=wcc386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCFLAGS)" tests
-
-WCX: .SYMBOLIC
- @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCXFLAGS)" tests
-
-WCE-bench: .SYMBOLIC
- @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCELIB)" CPDLL="$(WCEDLL)" EHFLAGS="$(WCEFLAGS)" XXLIBS="benchlib.o" benchtests
-
-WC-bench: .SYMBOLIC
- @ wmake /f Wmakefile CC=wcc386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCFLAGS)" XXLIBS="benchlib.o" benchtests
-
-WCX-bench: .SYMBOLIC
- @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCXFLAGS)" XXLIBS="benchlib.o" benchtests
-
-sizes.pass: sizes.exe
- @ $(ECHO) ... Running $(TEST) test: $^*
- @ $[@ > SIZES.$(TEST)
- @ $(CAT) SIZES.$(TEST)
- @ $(ECHO) ...... Passed
- @ $(TOUCH) $^@
-
-.exe.pass:
- @ $(ECHO) ... Running $(TEST) test: $^*
- @ $[@
- @ $(ECHO) ...... Passed
- @ $(TOUCH) $^@
-
-.obj.exe:
- @ $(ECHO) wlink NAME $^@ FILE $[@ LIBRARY $(CPLIB) OPTION quiet
- @ wlink NAME $^@ FILE $[@ LIBRARY $(CPLIB) OPTION quiet
-
-.c.obj:
- @ $(ECHO) $(CC) $^* $(EHFLAGS) $(CFLAGS) $(INCLUDES)
- @ $(CC) $^* $(EHFLAGS) $(CFLAGS) $(INCLUDES)
-
-.c.i:
- @ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
-
-$(COPYFILES): .SYMBOLIC
- @ $(ECHO) Copying $(BUILD_DIR)\$@
- @ $(CP) $(BUILD_DIR)\$@ .
-
-pthread.dll:
- @ $(CP) $(CPDLL) $*.dll
- @ $(CP) $(CPLIB) $*.lib
-
-clean: .SYMBOLIC
- @ if exist *.dll $(RM) *.dll
- @ if exist *.lib $(RM) *.lib
- @ if exist *.err $(RM) *.err
- @ 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 *.pass $(RM) *.pass
- @ if exist *.bench $(RM) *.bench
- @ if exist *.log $(RM) *.log
- @ $(ECHO) Clean completed.
-
-benchtest1.bench:
-benchtest2.bench:
-benchtest3.bench:
-benchtest4.bench:
-benchtest5.bench:
-barrier1.pass:
-barrier2.pass: barrier1.pass
-barrier3.pass: barrier2.pass
-barrier4.pass: barrier3.pass
-barrier5.pass: barrier4.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
-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: cancel2.pass
-count1.pass: join1.pass
-create1.pass: mutex2.pass
-create2.pass: create1.pass
-create3.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
-rwlock1.pass: condvar6.pass
-rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.pass
-rwlock4.pass: rwlock3.pass
-rwlock5.pass: rwlock4.pass
-rwlock6.pass: rwlock5.pass
-rwlock7.pass: rwlock6.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
-sizes.pass:
-spin1.pass:
-spin2.pass: spin1.pass
-spin3.pass: spin2.pass
-spin4.pass: spin3.pass
-stress1.pass:
-tsd1.pass: join1.pass
-valid1.pass: join1.pass
-valid2.pass: valid1.pass
-cancel9.pass: cancel8.pass
+# Watcom makefile for the pthreads test suite.
+# If all of the .pass files can be created, the test suite has passed.
+#
+# --------------------------------------------------------------------------
+#
+# 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
+#
+
+
+DLL_VER = 2
+
+.EXTENSIONS:
+
+.EXTENSIONS: .pass .exe .obj .i .c
+
+CP = copy
+RM = erase
+CAT = type
+MKDIR = mkdir
+TOUCH = echo Passed >
+ECHO = @echo
+
+CPHDR = pthread.h semaphore.h sched.h
+
+OPTIM = -od
+
+XXLIBS =
+
+# C++ Exceptions
+WCEFLAGS = -xs -dPtW32NoCatchWarn -d__CLEANUP_CXX
+WCELIB = pthreadWCE$(DLL_VER).lib
+WCEDLL = pthreadWCE$(DLL_VER).dll
+# C cleanup code
+WCFLAGS = -d__CLEANUP_C
+WCLIB = pthreadWC$(DLL_VER).lib
+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
+
+LFLAGS=
+INCLUDES= -i=.
+BUILD_DIR=..
+
+# The next path is relative to $BUILD_DIR
+QAPC = # ..\QueueUserAPCEx\User\quserex.dll
+
+COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
+
+TEST =
+EHFLAGS =
+
+# If a test case returns a non-zero exit code to the shell, make will
+# stop.
+
+PASSES = sizes.pass 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 exit5 &
+ 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 tsd1.pass &
+ self2.pass &
+ cancel1.pass cancel2.pass &
+ semaphore4.pass semaphore4t.pass semaphore5.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 cancel8 &
+ cleanup0.pass cleanup1.pass cleanup2.pass cleanup3.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
+
+BENCHRESULTS = &
+ benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench
+
+help: .SYMBOLIC
+ @ $(ECHO) Run one of the following command lines:
+ @ $(ECHO) wmake /f Wmakefile clean WC (to test using WC dll with wcc386 (no EH) applications)
+ @ $(ECHO) wmake /f Wmakefile clean WCX (to test using WC dll with wpp386 (EH) applications)
+ @ $(ECHO) wmake /f Wmakefile clean WCE (to test using the WCE dll with wpp386 EH applications)
+ @ $(ECHO) wmake /f Wmakefile clean WC-bench (to benchtest using WC dll with C bench app)
+ @ $(ECHO) wmake /f Wmakefile clean WCX-bench (to benchtest using WC dll with C++ bench app)
+ @ $(ECHO) wmake /f Wmakefile clean WCE-bench (to benchtest using WCE dll with C++ bench app)
+
+all: .SYMBOLIC
+ @ wmake /f Wmakefile clean WC
+ @ wmake /f Wmakefile clean WCX
+ @ wmake /f Wmakefile clean WCE
+ @ wmake /f Wmakefile clean WSE
+ @ wmake /f Wmakefile clean WC-bench
+
+tests: $(CPLIB) $(CPDLL) $(CPHDR) $(PASSES) .SYMBOLIC
+ @ $(ECHO) ALL TESTS PASSED! Congratulations!
+
+benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(XXLIBS) $(BENCHRESULTS) .SYMBOLIC
+ @ $(ECHO) ALL BENCH TESTS DONE.
+
+$(BENCHRESULTS): ($[*).exe
+ @ $(ECHO) ... Running $(TEST) benchtest: ($[*).exe
+ @ .\($[*).exe
+ @ $(ECHO) ...... Done
+ @ $(TOUCH) ($[*).bench
+
+WCE: .SYMBOLIC
+ @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCELIB)" CPDLL="$(WCEDLL)" EHFLAGS="$(WCEFLAGS)" tests
+
+WC: .SYMBOLIC
+ @ wmake /f Wmakefile CC=wcc386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCFLAGS)" tests
+
+WCX: .SYMBOLIC
+ @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCXFLAGS)" tests
+
+WCE-bench: .SYMBOLIC
+ @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCELIB)" CPDLL="$(WCEDLL)" EHFLAGS="$(WCEFLAGS)" XXLIBS="benchlib.o" benchtests
+
+WC-bench: .SYMBOLIC
+ @ wmake /f Wmakefile CC=wcc386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCFLAGS)" XXLIBS="benchlib.o" benchtests
+
+WCX-bench: .SYMBOLIC
+ @ wmake /f Wmakefile CC=wpp386 TEST="$@" CPLIB="$(WCLIB)" CPDLL="$(WCDLL)" EHFLAGS="$(WCXFLAGS)" XXLIBS="benchlib.o" benchtests
+
+sizes.pass: sizes.exe
+ @ $(ECHO) ... Running $(TEST) test: $^*
+ @ $[@ > SIZES.$(TEST)
+ @ $(CAT) SIZES.$(TEST)
+ @ $(ECHO) ...... Passed
+ @ $(TOUCH) $^@
+
+.exe.pass:
+ @ $(ECHO) ... Running $(TEST) test: $^*
+ @ $[@
+ @ $(ECHO) ...... Passed
+ @ $(TOUCH) $^@
+
+.obj.exe:
+ @ $(ECHO) wlink NAME $^@ FILE $[@ LIBRARY $(CPLIB) OPTION quiet
+ @ wlink NAME $^@ FILE $[@ LIBRARY $(CPLIB) OPTION quiet
+
+.c.obj:
+ @ $(ECHO) $(CC) $^* $(EHFLAGS) $(CFLAGS) $(INCLUDES)
+ @ $(CC) $^* $(EHFLAGS) $(CFLAGS) $(INCLUDES)
+
+.c.i:
+ @ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
+
+$(COPYFILES): .SYMBOLIC
+ @ $(ECHO) Copying $(BUILD_DIR)\$@
+ @ $(CP) $(BUILD_DIR)\$@ .
+
+pthread.dll:
+ @ $(CP) $(CPDLL) $*.dll
+ @ $(CP) $(CPLIB) $*.lib
+
+clean: .SYMBOLIC
+ @ if exist *.dll $(RM) *.dll
+ @ if exist *.lib $(RM) *.lib
+ @ if exist *.err $(RM) *.err
+ @ 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 *.pass $(RM) *.pass
+ @ if exist *.bench $(RM) *.bench
+ @ if exist *.log $(RM) *.log
+ @ $(ECHO) Clean completed.
+
+benchtest1.bench:
+benchtest2.bench:
+benchtest3.bench:
+benchtest4.bench:
+benchtest5.bench:
+barrier1.pass:
+barrier2.pass: barrier1.pass
+barrier3.pass: barrier2.pass
+barrier4.pass: barrier3.pass
+barrier5.pass: barrier4.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
+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
+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: join1.pass
+valid1.pass: join1.pass
+valid2.pass: valid1.pass
+cancel9.pass: cancel8.pass
diff --git a/pthreads/tests/barrier3.c b/pthreads/tests/barrier3.c
index 3e4009068..dece77068 100644
--- a/pthreads/tests/barrier3.c
+++ b/pthreads/tests/barrier3.c
@@ -41,11 +41,11 @@
#include "test.h"
pthread_barrier_t barrier = NULL;
-static int result = 1;
+static void* result = (void*)1;
void * func(void * arg)
{
- return (void *) pthread_barrier_wait(&barrier);
+ return (void *) (size_t)pthread_barrier_wait(&barrier);
}
int
@@ -60,9 +60,9 @@ main()
assert(pthread_create(&t, NULL, func, NULL) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
+ assert(pthread_join(t, &result) == 0);
- assert(result == PTHREAD_BARRIER_SERIAL_THREAD);
+ assert((int)(size_t)result == PTHREAD_BARRIER_SERIAL_THREAD);
assert(pthread_barrier_destroy(&barrier) == 0);
assert(pthread_barrierattr_destroy(&ba) == 0);
diff --git a/pthreads/tests/barrier5.c b/pthreads/tests/barrier5.c
index 42c2e36d9..353384081 100644
--- a/pthreads/tests/barrier5.c
+++ b/pthreads/tests/barrier5.c
@@ -1,118 +1,118 @@
-/*
- * barrier5.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
- *
- * --------------------------------------------------------------------------
- *
- * Set up a series of barriers at different heights and test various numbers
- * of threads accessing, especially cases where there are more threads than the
- * barrier height (count), i.e. test contention when the barrier is released.
- */
-
-#include "test.h"
-
-enum {
- NUMTHREADS = 15,
- HEIGHT = 10,
- BARRIERMULTIPLE = 1000
-};
-
-pthread_barrier_t barrier = NULL;
-pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
-LONG totalThreadCrossings;
-
-void *
-func(void * crossings)
-{
- int result;
- int serialThreads = 0;
-
- while ((LONG)crossings >= (LONG)InterlockedIncrement((LPLONG)&totalThreadCrossings))
- {
- result = pthread_barrier_wait(&barrier);
-
- if (result == PTHREAD_BARRIER_SERIAL_THREAD)
- {
- serialThreads++;
- }
- else if (result != 0)
- {
- printf("Barrier failed: result = %s\n", error_string[result]);
- fflush(stdout);
- return NULL;
- }
- }
-
- return (void *) serialThreads;
-}
-
-int
-main()
-{
- int i, j;
- int result;
- int serialThreadsTotal;
- LONG Crossings;
- pthread_t t[NUMTHREADS + 1];
-
- for (j = 1; j <= NUMTHREADS; j++)
- {
- int height = j<HEIGHT?j:HEIGHT;
-
- totalThreadCrossings = 0;
- Crossings = height * BARRIERMULTIPLE;
-
- printf("Threads=%d, Barrier height=%d\n", j, height);
-
- assert(pthread_barrier_init(&barrier, NULL, height) == 0);
-
- for (i = 1; i <= j; i++)
- {
- assert(pthread_create(&t[i], NULL, func, (void *) Crossings) == 0);
- }
-
- serialThreadsTotal = 0;
- for (i = 1; i <= j; i++)
- {
- assert(pthread_join(t[i], (void **) &result) == 0);
- serialThreadsTotal += result;
- }
-
- assert(serialThreadsTotal == BARRIERMULTIPLE);
-
- assert(pthread_barrier_destroy(&barrier) == 0);
- }
-
- assert(pthread_mutex_destroy(&mx) == 0);
-
- return 0;
-}
+/*
+ * barrier5.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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Set up a series of barriers at different heights and test various numbers
+ * of threads accessing, especially cases where there are more threads than the
+ * barrier height (count), i.e. test contention when the barrier is released.
+ */
+
+#include "test.h"
+
+enum {
+ NUMTHREADS = 15,
+ HEIGHT = 10,
+ BARRIERMULTIPLE = 1000
+};
+
+pthread_barrier_t barrier = NULL;
+pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
+LONG totalThreadCrossings;
+
+void *
+func(void * crossings)
+{
+ int result;
+ int serialThreads = 0;
+
+ while ((LONG)(size_t)crossings >= (LONG)InterlockedIncrement((LPLONG)&totalThreadCrossings))
+ {
+ result = pthread_barrier_wait(&barrier);
+
+ if (result == PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ serialThreads++;
+ }
+ else if (result != 0)
+ {
+ printf("Barrier failed: result = %s\n", error_string[result]);
+ fflush(stdout);
+ return NULL;
+ }
+ }
+
+ return (void*)(size_t)serialThreads;
+}
+
+int
+main()
+{
+ int i, j;
+ void* result;
+ int serialThreadsTotal;
+ LONG Crossings;
+ pthread_t t[NUMTHREADS + 1];
+
+ for (j = 1; j <= NUMTHREADS; j++)
+ {
+ int height = j<HEIGHT?j:HEIGHT;
+
+ totalThreadCrossings = 0;
+ Crossings = height * BARRIERMULTIPLE;
+
+ printf("Threads=%d, Barrier height=%d\n", j, height);
+
+ assert(pthread_barrier_init(&barrier, NULL, height) == 0);
+
+ for (i = 1; i <= j; i++)
+ {
+ assert(pthread_create(&t[i], NULL, func, (void *)(size_t)Crossings) == 0);
+ }
+
+ serialThreadsTotal = 0;
+ for (i = 1; i <= j; i++)
+ {
+ assert(pthread_join(t[i], &result) == 0);
+ serialThreadsTotal += (int)(size_t)result;
+ }
+
+ assert(serialThreadsTotal == BARRIERMULTIPLE);
+
+ assert(pthread_barrier_destroy(&barrier) == 0);
+ }
+
+ assert(pthread_mutex_destroy(&mx) == 0);
+
+ return 0;
+}
diff --git a/pthreads/tests/benchtest1.c b/pthreads/tests/benchtest1.c
index 116dad05e..191f98636 100644
--- a/pthreads/tests/benchtest1.c
+++ b/pthreads/tests/benchtest1.c
@@ -53,25 +53,27 @@
pthread_mutex_t mx;
pthread_mutexattr_t ma;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+PTW32_STRUCT_TIMEB currSysTimeStart;
+PTW32_STRUCT_TIMEB currSysTimeStop;
long durationMilliSecs;
long overHeadMilliSecs = 0;
+int two = 2;
int one = 1;
int zero = 0;
+int iter;
-#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- - (_TStart.time*1000+_TStart.millitm))
+#define GetDurationMilliSecs(_TStart, _TStop) ((long)((_TStop.time*1000+_TStop.millitm) \
+ - (_TStart.time*1000+_TStart.millitm)))
/*
* Dummy use of j, otherwise the loop may be removed by the optimiser
* when doing the overhead timing with an empty loop.
*/
#define TESTSTART \
- { int i, j = 0, k = 0; _ftime(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
+ { int i, j = 0, k = 0; PTW32_FTIME(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
#define TESTSTOP \
- }; _ftime(&currSysTimeStop); if (j + k == i) j++; }
+ }; PTW32_FTIME(&currSysTimeStop); if (j + k == i) j++; }
void
@@ -83,8 +85,8 @@ runTest (char * testNameString, int mType)
assert(pthread_mutex_init(&mx, &ma) == 0);
TESTSTART
- assert(pthread_mutex_lock(&mx) == zero);
- assert(pthread_mutex_unlock(&mx) == zero);
+ assert((pthread_mutex_lock(&mx),1) == one);
+ assert((pthread_mutex_unlock(&mx),2) == two);
TESTSTOP
assert(pthread_mutex_destroy(&mx) == 0);
@@ -118,10 +120,9 @@ main (int argc, char *argv[])
/*
* Time the loop overhead so we can subtract it from the actual test times.
*/
-
TESTSTART
assert(1 == one);
- assert(1 == one);
+ assert(2 == two);
TESTSTOP
durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
@@ -130,7 +131,7 @@ main (int argc, char *argv[])
TESTSTART
assert((dummy_call(&i), 1) == one);
- assert((dummy_call(&i), 1) == one);
+ assert((dummy_call(&i), 2) == two);
TESTSTOP
durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
@@ -138,12 +139,12 @@ main (int argc, char *argv[])
printf( "%-45s %15ld %15.3f\n",
"Dummy call x 2",
durationMilliSecs,
- (float) durationMilliSecs * 1E3 / ITERATIONS);
+ (float) (durationMilliSecs * 1E3 / ITERATIONS));
TESTSTART
assert((interlocked_inc_with_conditionals(&i), 1) == one);
- assert((interlocked_dec_with_conditionals(&i), 1) == one);
+ assert((interlocked_dec_with_conditionals(&i), 2) == two);
TESTSTOP
durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
@@ -156,7 +157,7 @@ main (int argc, char *argv[])
TESTSTART
assert((InterlockedIncrement((LPLONG)&i), 1) == (LONG)one);
- assert((InterlockedDecrement((LPLONG)&i), 1) == (LONG)one);
+ assert((InterlockedDecrement((LPLONG)&i), 2) == (LONG)two);
TESTSTOP
durationMilliSecs = GetDurationMilliSecs(currSysTimeStart, currSysTimeStop) - overHeadMilliSecs;
@@ -171,7 +172,7 @@ main (int argc, char *argv[])
TESTSTART
assert((EnterCriticalSection(&cs), 1) == one);
- assert((LeaveCriticalSection(&cs), 1) == one);
+ assert((LeaveCriticalSection(&cs), 2) == two);
TESTSTOP
DeleteCriticalSection(&cs);
@@ -225,13 +226,29 @@ main (int argc, char *argv[])
* Now we can start the actual tests
*/
#ifdef PTW32_MUTEX_TYPES
- runTest("PTHREAD_MUTEX_DEFAULT (W9x,WNT)", PTHREAD_MUTEX_DEFAULT);
+ runTest("PTHREAD_MUTEX_DEFAULT", PTHREAD_MUTEX_DEFAULT);
+
+ runTest("PTHREAD_MUTEX_NORMAL", PTHREAD_MUTEX_NORMAL);
+
+ runTest("PTHREAD_MUTEX_ERRORCHECK", PTHREAD_MUTEX_ERRORCHECK);
+
+ runTest("PTHREAD_MUTEX_RECURSIVE", PTHREAD_MUTEX_RECURSIVE);
+#else
+ runTest("Non-blocking lock", 0);
+#endif
+
+ printf( ".............................................................................\n");
+
+ pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST);
+
+#ifdef PTW32_MUTEX_TYPES
+ runTest("PTHREAD_MUTEX_DEFAULT (Robust)", PTHREAD_MUTEX_DEFAULT);
- runTest("PTHREAD_MUTEX_NORMAL (W9x,WNT)", PTHREAD_MUTEX_NORMAL);
+ runTest("PTHREAD_MUTEX_NORMAL (Robust)", PTHREAD_MUTEX_NORMAL);
- runTest("PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)", PTHREAD_MUTEX_ERRORCHECK);
+ runTest("PTHREAD_MUTEX_ERRORCHECK (Robust)", PTHREAD_MUTEX_ERRORCHECK);
- runTest("PTHREAD_MUTEX_RECURSIVE (W9x,WNT)", PTHREAD_MUTEX_RECURSIVE);
+ runTest("PTHREAD_MUTEX_RECURSIVE (Robust)", PTHREAD_MUTEX_RECURSIVE);
#else
runTest("Non-blocking lock", 0);
#endif
diff --git a/pthreads/tests/benchtest2.c b/pthreads/tests/benchtest2.c
index d92bb3c1a..10f3d0ee8 100644
--- a/pthreads/tests/benchtest2.c
+++ b/pthreads/tests/benchtest2.c
@@ -60,23 +60,23 @@ CRITICAL_SECTION cs1, cs2;
pthread_mutexattr_t ma;
long durationMilliSecs;
long overHeadMilliSecs = 0;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+PTW32_STRUCT_TIMEB currSysTimeStart;
+PTW32_STRUCT_TIMEB currSysTimeStop;
pthread_t worker;
int running = 0;
-#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- - (_TStart.time*1000+_TStart.millitm))
+#define GetDurationMilliSecs(_TStart, _TStop) ((long)((_TStop.time*1000+_TStop.millitm) \
+ - (_TStart.time*1000+_TStart.millitm)))
/*
* Dummy use of j, otherwise the loop may be removed by the optimiser
* when doing the overhead timing with an empty loop.
*/
#define TESTSTART \
- { int i, j = 0, k = 0; _ftime(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
+ { int i, j = 0, k = 0; PTW32_FTIME(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
#define TESTSTOP \
- }; _ftime(&currSysTimeStop); if (j + k == i) j++; }
+ }; PTW32_FTIME(&currSysTimeStop); if (j + k == i) j++; }
void *
@@ -289,15 +289,31 @@ main (int argc, char *argv[])
* Now we can start the actual tests
*/
#ifdef PTW32_MUTEX_TYPES
- runTest("PTHREAD_MUTEX_DEFAULT (W9x,WNT)", PTHREAD_MUTEX_DEFAULT);
+ runTest("PTHREAD_MUTEX_DEFAULT", PTHREAD_MUTEX_DEFAULT);
- runTest("PTHREAD_MUTEX_NORMAL (W9x,WNT)", PTHREAD_MUTEX_NORMAL);
+ runTest("PTHREAD_MUTEX_NORMAL", PTHREAD_MUTEX_NORMAL);
- runTest("PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)", PTHREAD_MUTEX_ERRORCHECK);
+ runTest("PTHREAD_MUTEX_ERRORCHECK", PTHREAD_MUTEX_ERRORCHECK);
- runTest("PTHREAD_MUTEX_RECURSIVE (W9x,WNT)", PTHREAD_MUTEX_RECURSIVE);
+ runTest("PTHREAD_MUTEX_RECURSIVE", PTHREAD_MUTEX_RECURSIVE);
#else
- runTest("Blocking locks", 0);
+ runTest("Non-blocking lock", 0);
+#endif
+
+ printf( ".............................................................................\n");
+
+ pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST);
+
+#ifdef PTW32_MUTEX_TYPES
+ runTest("PTHREAD_MUTEX_DEFAULT (Robust)", PTHREAD_MUTEX_DEFAULT);
+
+ runTest("PTHREAD_MUTEX_NORMAL (Robust)", PTHREAD_MUTEX_NORMAL);
+
+ runTest("PTHREAD_MUTEX_ERRORCHECK (Robust)", PTHREAD_MUTEX_ERRORCHECK);
+
+ runTest("PTHREAD_MUTEX_RECURSIVE (Robust)", PTHREAD_MUTEX_RECURSIVE);
+#else
+ runTest("Non-blocking lock", 0);
#endif
printf( "=============================================================================\n");
diff --git a/pthreads/tests/benchtest3.c b/pthreads/tests/benchtest3.c
index 023460dfb..7d03ed884 100644
--- a/pthreads/tests/benchtest3.c
+++ b/pthreads/tests/benchtest3.c
@@ -54,23 +54,23 @@
pthread_mutex_t mx;
old_mutex_t ox;
pthread_mutexattr_t ma;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+PTW32_STRUCT_TIMEB currSysTimeStart;
+PTW32_STRUCT_TIMEB currSysTimeStop;
long durationMilliSecs;
long overHeadMilliSecs = 0;
-#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- - (_TStart.time*1000+_TStart.millitm))
+#define GetDurationMilliSecs(_TStart, _TStop) ((long)((_TStop.time*1000+_TStop.millitm) \
+ - (_TStart.time*1000+_TStart.millitm)))
/*
* Dummy use of j, otherwise the loop may be removed by the optimiser
* when doing the overhead timing with an empty loop.
*/
#define TESTSTART \
- { int i, j = 0, k = 0; _ftime(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
+ { int i, j = 0, k = 0; PTW32_FTIME(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
#define TESTSTOP \
- }; _ftime(&currSysTimeStop); if (j + k == i) j++; }
+ }; PTW32_FTIME(&currSysTimeStop); if (j + k == i) j++; }
void *
@@ -178,13 +178,29 @@ main (int argc, char *argv[])
* Now we can start the actual tests
*/
#ifdef PTW32_MUTEX_TYPES
- runTest("PTHREAD_MUTEX_DEFAULT (W9x,WNT)", PTHREAD_MUTEX_DEFAULT);
+ runTest("PTHREAD_MUTEX_DEFAULT", PTHREAD_MUTEX_DEFAULT);
- runTest("PTHREAD_MUTEX_NORMAL (W9x,WNT)", PTHREAD_MUTEX_NORMAL);
+ runTest("PTHREAD_MUTEX_NORMAL", PTHREAD_MUTEX_NORMAL);
- runTest("PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)", PTHREAD_MUTEX_ERRORCHECK);
+ runTest("PTHREAD_MUTEX_ERRORCHECK", PTHREAD_MUTEX_ERRORCHECK);
- runTest("PTHREAD_MUTEX_RECURSIVE (W9x,WNT)", PTHREAD_MUTEX_RECURSIVE);
+ runTest("PTHREAD_MUTEX_RECURSIVE", PTHREAD_MUTEX_RECURSIVE);
+#else
+ runTest("Non-blocking lock", 0);
+#endif
+
+ printf( ".............................................................................\n");
+
+ pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST);
+
+#ifdef PTW32_MUTEX_TYPES
+ runTest("PTHREAD_MUTEX_DEFAULT (Robust)", PTHREAD_MUTEX_DEFAULT);
+
+ runTest("PTHREAD_MUTEX_NORMAL (Robust)", PTHREAD_MUTEX_NORMAL);
+
+ runTest("PTHREAD_MUTEX_ERRORCHECK (Robust)", PTHREAD_MUTEX_ERRORCHECK);
+
+ runTest("PTHREAD_MUTEX_RECURSIVE (Robust)", PTHREAD_MUTEX_RECURSIVE);
#else
runTest("Non-blocking lock", 0);
#endif
diff --git a/pthreads/tests/benchtest4.c b/pthreads/tests/benchtest4.c
index 772d10047..d7cf47c3b 100644
--- a/pthreads/tests/benchtest4.c
+++ b/pthreads/tests/benchtest4.c
@@ -54,23 +54,23 @@
pthread_mutex_t mx;
old_mutex_t ox;
pthread_mutexattr_t ma;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+PTW32_STRUCT_TIMEB currSysTimeStart;
+PTW32_STRUCT_TIMEB currSysTimeStop;
long durationMilliSecs;
long overHeadMilliSecs = 0;
-#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- - (_TStart.time*1000+_TStart.millitm))
+#define GetDurationMilliSecs(_TStart, _TStop) ((long)((_TStop.time*1000+_TStop.millitm) \
+ - (_TStart.time*1000+_TStart.millitm)))
/*
* Dummy use of j, otherwise the loop may be removed by the optimiser
* when doing the overhead timing with an empty loop.
*/
#define TESTSTART \
- { int i, j = 0, k = 0; _ftime(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
+ { int i, j = 0, k = 0; PTW32_FTIME(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
#define TESTSTOP \
- }; _ftime(&currSysTimeStop); if (j + k == i) j++; }
+ }; PTW32_FTIME(&currSysTimeStop); if (j + k == i) j++; }
void
@@ -159,13 +159,29 @@ main (int argc, char *argv[])
* Now we can start the actual tests
*/
#ifdef PTW32_MUTEX_TYPES
- runTest("PTHREAD_MUTEX_DEFAULT (W9x,WNT)", PTHREAD_MUTEX_DEFAULT);
+ runTest("PTHREAD_MUTEX_DEFAULT", PTHREAD_MUTEX_DEFAULT);
- runTest("PTHREAD_MUTEX_NORMAL (W9x,WNT)", PTHREAD_MUTEX_NORMAL);
+ runTest("PTHREAD_MUTEX_NORMAL", PTHREAD_MUTEX_NORMAL);
- runTest("PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)", PTHREAD_MUTEX_ERRORCHECK);
+ runTest("PTHREAD_MUTEX_ERRORCHECK", PTHREAD_MUTEX_ERRORCHECK);
- runTest("PTHREAD_MUTEX_RECURSIVE (W9x,WNT)", PTHREAD_MUTEX_RECURSIVE);
+ runTest("PTHREAD_MUTEX_RECURSIVE", PTHREAD_MUTEX_RECURSIVE);
+#else
+ runTest("Non-blocking lock", 0);
+#endif
+
+ printf( ".............................................................................\n");
+
+ pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST);
+
+#ifdef PTW32_MUTEX_TYPES
+ runTest("PTHREAD_MUTEX_DEFAULT (Robust)", PTHREAD_MUTEX_DEFAULT);
+
+ runTest("PTHREAD_MUTEX_NORMAL (Robust)", PTHREAD_MUTEX_NORMAL);
+
+ runTest("PTHREAD_MUTEX_ERRORCHECK (Robust)", PTHREAD_MUTEX_ERRORCHECK);
+
+ runTest("PTHREAD_MUTEX_RECURSIVE (Robust)", PTHREAD_MUTEX_RECURSIVE);
#else
runTest("Non-blocking lock", 0);
#endif
diff --git a/pthreads/tests/benchtest5.c b/pthreads/tests/benchtest5.c
index 7700fdeaa..d262baf11 100644
--- a/pthreads/tests/benchtest5.c
+++ b/pthreads/tests/benchtest5.c
@@ -53,25 +53,25 @@
sem_t sema;
HANDLE w32sema;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+PTW32_STRUCT_TIMEB currSysTimeStart;
+PTW32_STRUCT_TIMEB currSysTimeStop;
long durationMilliSecs;
long overHeadMilliSecs = 0;
int one = 1;
int zero = 0;
-#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- - (_TStart.time*1000+_TStart.millitm))
+#define GetDurationMilliSecs(_TStart, _TStop) ((long)((_TStop.time*1000+_TStop.millitm) \
+ - (_TStart.time*1000+_TStart.millitm)))
/*
* Dummy use of j, otherwise the loop may be removed by the optimiser
* when doing the overhead timing with an empty loop.
*/
#define TESTSTART \
- { int i, j = 0, k = 0; _ftime(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
+ { int i, j = 0, k = 0; PTW32_FTIME(&currSysTimeStart); for (i = 0; i < ITERATIONS; i++) { j++;
#define TESTSTOP \
- }; _ftime(&currSysTimeStop); if (j + k == i) j++; }
+ }; PTW32_FTIME(&currSysTimeStop); if (j + k == i) j++; }
void
@@ -115,7 +115,7 @@ main (int argc, char *argv[])
*/
assert((w32sema = CreateSemaphore(NULL, (long) 0, (long) ITERATIONS, NULL)) != 0);
TESTSTART
- assert(ReleaseSemaphore(w32sema, 1, NULL) != zero);
+ assert((ReleaseSemaphore(w32sema, 1, NULL),1) == one);
TESTSTOP
assert(CloseHandle(w32sema) != 0);
@@ -124,7 +124,7 @@ main (int argc, char *argv[])
assert((w32sema = CreateSemaphore(NULL, (long) ITERATIONS, (long) ITERATIONS, NULL)) != 0);
TESTSTART
- assert(WaitForSingleObject(w32sema, INFINITE) == WAIT_OBJECT_0);
+ assert((WaitForSingleObject(w32sema, INFINITE),1) == one);
TESTSTOP
assert(CloseHandle(w32sema) != 0);
@@ -133,7 +133,7 @@ main (int argc, char *argv[])
assert(sem_init(&sema, 0, 0) == 0);
TESTSTART
- assert(sem_post(&sema) == zero);
+ assert((sem_post(&sema),1) == one);
TESTSTOP
assert(sem_destroy(&sema) == 0);
@@ -142,7 +142,7 @@ main (int argc, char *argv[])
assert(sem_init(&sema, 0, ITERATIONS) == 0);
TESTSTART
- assert(sem_wait(&sema) == zero);
+ assert((sem_wait(&sema),1) == one);
TESTSTOP
assert(sem_destroy(&sema) == 0);
diff --git a/pthreads/tests/cancel1.c b/pthreads/tests/cancel1.c
index be9b102a5..23d2726a2 100644
--- a/pthreads/tests/cancel1.c
+++ b/pthreads/tests/cancel1.c
@@ -145,7 +145,7 @@ main()
/*
* Give threads time to run.
*/
- Sleep(NUMTHREADS * 1000);
+ Sleep(NUMTHREADS * 100);
/*
* Standard check that all threads started.
diff --git a/pthreads/tests/cancel2.c b/pthreads/tests/cancel2.c
index 6ef2043e2..2ee596abb 100644
--- a/pthreads/tests/cancel2.c
+++ b/pthreads/tests/cancel2.c
@@ -72,7 +72,10 @@
* - Process returns non-zero exit status.
*/
-#if defined(_MSC_VER) || defined(__cplusplus)
+/*
+ * Don't know how to identify if we are using SEH so it's only C++ for now
+ */
+#if defined(__cplusplus)
#include "test.h"
@@ -80,7 +83,7 @@
* Create NUMTHREADS threads in addition to the Main thread.
*/
enum {
- NUMTHREADS = 1
+ NUMTHREADS = 4
};
typedef struct bag_t_ bag_t;
@@ -120,7 +123,7 @@ mythread(void * arg)
break;
}
-#if defined(_MSC_VER) && !defined(__cplusplus)
+#if !defined(__cplusplus)
__try
#else
try
@@ -136,7 +139,7 @@ mythread(void * arg)
pthread_testcancel();
}
}
-#if defined(_MSC_VER) && !defined(__cplusplus)
+#if !defined(__cplusplus)
__except(EXCEPTION_EXECUTE_HANDLER)
#else
#if defined(PtW32CatchAll)
@@ -157,7 +160,7 @@ mythread(void * arg)
*/
result += 1000;
- return (void *) result;
+ return (void *) (size_t)result;
}
int
@@ -217,17 +220,17 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
- assert(pthread_join(t[i], (void **) &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ assert(pthread_join(t[i], &result) == 0);
+ fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
if (fail)
{
fprintf(stderr, "Thread %d: started %d: location %d: cancel type %s\n",
i,
threadbag[i].started,
- result,
- ((result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED");
+ (int)(size_t)result,
+ (((int)(size_t)result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED");
}
failed |= fail;
}
@@ -240,12 +243,16 @@ main()
return 0;
}
-#else /* defined(_MSC_VER) || defined(__cplusplus) */
+#else /* defined(__cplusplus) */
+
+#include <stdio.h>
int
main()
{
+ fprintf(stderr, "Test N/A for this compiler environment.\n");
return 0;
}
-#endif /* defined(_MSC_VER) || defined(__cplusplus) */
+#endif /* defined(__cplusplus) */
+
diff --git a/pthreads/tests/cancel3.c b/pthreads/tests/cancel3.c
index 7bc3b6ea0..5020648a6 100644
--- a/pthreads/tests/cancel3.c
+++ b/pthreads/tests/cancel3.c
@@ -1,201 +1,201 @@
-/*
- * File: cancel3.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 asynchronous cancelation (alertable or non-alertable).
- *
- * Test Method (Validation or Falsification):
- * -
- *
- * Requirements Tested:
- * - Async cancel if thread is not blocked (i.e. voluntarily resumes if blocked).
- *
- * 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, pthread_join.
- * - quserex.dll and alertdrv.sys are not available.
- *
- * Pass Criteria:
- * - Process returns zero exit status.
- *
- * Fail Criteria:
- * - Process returns non-zero exit status.
- */
-
-#include "test.h"
-
-/*
- * Create NUMTHREADS threads in addition to the Main thread.
- */
-enum
-{
- NUMTHREADS = 4
-};
-
-typedef struct bag_t_ bag_t;
-struct bag_t_
-{
- int threadnum;
- int started;
- /* Add more per-thread state variables here */
- int count;
-};
-
-static bag_t threadbag[NUMTHREADS + 1];
-
-void *
-mythread (void *arg)
-{
- int result = ((int) PTHREAD_CANCELED + 1);
- bag_t *bag = (bag_t *) arg;
-
- assert (bag == &threadbag[bag->threadnum]);
- assert (bag->started == 0);
- bag->started = 1;
-
- /* Set to known state and type */
-
- assert (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) == 0);
-
- assert (pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0);
-
- /*
- * We wait up to 10 seconds, waking every 0.1 seconds,
- * for a cancelation to be applied to us.
- */
- for (bag->count = 0; bag->count < 100; bag->count++)
- Sleep (100);
-
- return (void *) result;
-}
-
-int
-main ()
-{
- int failed = 0;
- int i;
- pthread_t t[NUMTHREADS + 1];
-
- assert ((t[0] = pthread_self ()).p != NULL);
-
- for (i = 1; i <= NUMTHREADS; i++)
- {
- threadbag[i].started = 0;
- threadbag[i].threadnum = i;
- assert (pthread_create (&t[i], NULL, mythread, (void *) &threadbag[i])
- == 0);
- }
-
- /*
- * Code to control or munipulate child threads should probably go here.
- */
- Sleep (500);
-
- for (i = 1; i <= NUMTHREADS; i++)
- {
- assert (pthread_cancel (t[i]) == 0);
- }
-
- /*
- * Give threads time to run.
- */
- Sleep (NUMTHREADS * 100);
-
- /*
- * Standard check that all threads started.
- */
- 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);
- }
- }
-
- assert (!failed);
-
- /*
- * Check any results here. Set "failed" and only print output on failure.
- */
- failed = 0;
- for (i = 1; i <= NUMTHREADS; i++)
- {
- int fail = 0;
- int result = 0;
-
- /*
- * The thread does not contain any cancelation points, so
- * a return value of PTHREAD_CANCELED confirms that async
- * cancelation succeeded.
- */
- assert (pthread_join (t[i], (void **) &result) == 0);
-
- fail = (result != (int) PTHREAD_CANCELED);
-
- if (fail)
- {
- fprintf (stderr, "Thread %d: started %d: count %d\n",
- i, threadbag[i].started, threadbag[i].count);
- }
- failed = (failed || fail);
- }
-
- assert (!failed);
-
- /*
- * Success.
- */
- return 0;
-}
+/*
+ * File: cancel3.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 asynchronous cancelation (alertable or non-alertable).
+ *
+ * Test Method (Validation or Falsification):
+ * -
+ *
+ * Requirements Tested:
+ * - Async cancel if thread is not blocked (i.e. voluntarily resumes if blocked).
+ *
+ * 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, pthread_join.
+ * - quserex.dll and alertdrv.sys are not available.
+ *
+ * Pass Criteria:
+ * - Process returns zero exit status.
+ *
+ * Fail Criteria:
+ * - Process returns non-zero exit status.
+ */
+
+#include "test.h"
+
+/*
+ * Create NUMTHREADS threads in addition to the Main thread.
+ */
+enum
+{
+ NUMTHREADS = 4
+};
+
+typedef struct bag_t_ bag_t;
+struct bag_t_
+{
+ int threadnum;
+ int started;
+ /* Add more per-thread state variables here */
+ int count;
+};
+
+static bag_t threadbag[NUMTHREADS + 1];
+
+void *
+mythread (void *arg)
+{
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
+ bag_t *bag = (bag_t *) arg;
+
+ assert (bag == &threadbag[bag->threadnum]);
+ assert (bag->started == 0);
+ bag->started = 1;
+
+ /* Set to known state and type */
+
+ assert (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) == 0);
+
+ assert (pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0);
+
+ /*
+ * We wait up to 10 seconds, waking every 0.1 seconds,
+ * for a cancelation to be applied to us.
+ */
+ for (bag->count = 0; bag->count < 100; bag->count++)
+ Sleep (100);
+
+ return result;
+}
+
+int
+main ()
+{
+ int failed = 0;
+ int i;
+ pthread_t t[NUMTHREADS + 1];
+
+ assert ((t[0] = pthread_self ()).p != NULL);
+
+ for (i = 1; i <= NUMTHREADS; i++)
+ {
+ threadbag[i].started = 0;
+ threadbag[i].threadnum = i;
+ assert (pthread_create (&t[i], NULL, mythread, (void *) &threadbag[i])
+ == 0);
+ }
+
+ /*
+ * Code to control or munipulate child threads should probably go here.
+ */
+ Sleep (NUMTHREADS * 100);
+
+ for (i = 1; i <= NUMTHREADS; i++)
+ {
+ assert (pthread_cancel (t[i]) == 0);
+ }
+
+ /*
+ * Give threads time to complete.
+ */
+ Sleep (NUMTHREADS * 100);
+
+ /*
+ * Standard check that all threads started.
+ */
+ 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);
+ }
+ }
+
+ assert (!failed);
+
+ /*
+ * Check any results here. Set "failed" and only print output on failure.
+ */
+ failed = 0;
+ for (i = 1; i <= NUMTHREADS; i++)
+ {
+ int fail = 0;
+ void* result = (void*)0;
+
+ /*
+ * The thread does not contain any cancelation points, so
+ * a return value of PTHREAD_CANCELED confirms that async
+ * cancelation succeeded.
+ */
+ assert (pthread_join (t[i], &result) == 0);
+
+ fail = (result != PTHREAD_CANCELED);
+
+ if (fail)
+ {
+ fprintf (stderr, "Thread %d: started %d: count %d\n",
+ i, threadbag[i].started, threadbag[i].count);
+ }
+ failed = (failed || fail);
+ }
+
+ assert (!failed);
+
+ /*
+ * Success.
+ */
+ return 0;
+}
diff --git a/pthreads/tests/cancel4.c b/pthreads/tests/cancel4.c
index 6d6d3dc7b..893f33b12 100644
--- a/pthreads/tests/cancel4.c
+++ b/pthreads/tests/cancel4.c
@@ -98,7 +98,7 @@ static bag_t threadbag[NUMTHREADS + 1];
void *
mythread(void * arg)
{
- int result = ((int)PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
bag_t * bag = (bag_t *) arg;
assert(bag == &threadbag[bag->threadnum]);
@@ -118,7 +118,7 @@ mythread(void * arg)
for (bag->count = 0; bag->count < 20; bag->count++)
Sleep(100);
- return (void *) result;
+ return result;
}
int
@@ -173,16 +173,16 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/*
* The thread does not contain any cancelation points, so
* a return value of PTHREAD_CANCELED indicates that async
* cancelation occurred.
*/
- assert(pthread_join(t[i], (void **) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = (result == (int) PTHREAD_CANCELED);
+ fail = (result == PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cancel5.c b/pthreads/tests/cancel5.c
index dd6cb8bae..6c3951634 100644
--- a/pthreads/tests/cancel5.c
+++ b/pthreads/tests/cancel5.c
@@ -96,7 +96,7 @@ static bag_t threadbag[NUMTHREADS + 1];
void *
mythread (void *arg)
{
- int result = ((int) PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
bag_t *bag = (bag_t *) arg;
assert (bag == &threadbag[bag->threadnum]);
@@ -116,7 +116,7 @@ mythread (void *arg)
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep (100);
- return (void *) result;
+ return result;
}
int
@@ -171,16 +171,16 @@ main ()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
/*
* The thread does not contain any cancelation points, so
* a return value of PTHREAD_CANCELED confirms that async
* cancelation succeeded.
*/
- assert (pthread_join (t[i], (void **) &result) == 0);
+ assert (pthread_join (t[i], &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cancel6a.c b/pthreads/tests/cancel6a.c
index 644cd4a53..58063d573 100644
--- a/pthreads/tests/cancel6a.c
+++ b/pthreads/tests/cancel6a.c
@@ -85,7 +85,7 @@ static bag_t threadbag[NUMTHREADS + 1];
void *
mythread(void * arg)
{
- int result = ((int)PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
bag_t * bag = (bag_t *) arg;
assert(bag == &threadbag[bag->threadnum]);
@@ -105,7 +105,7 @@ mythread(void * arg)
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep(100);
- return (void *) result;
+ return result;
}
int
@@ -161,16 +161,16 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/*
* The thread does not contain any cancelation points, so
* a return value of PTHREAD_CANCELED confirms that async
* cancelation succeeded.
*/
- assert(pthread_join(t[i], (void **) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cancel6d.c b/pthreads/tests/cancel6d.c
index d0ad7ac2c..37f9ca5f3 100644
--- a/pthreads/tests/cancel6d.c
+++ b/pthreads/tests/cancel6d.c
@@ -86,7 +86,7 @@ static bag_t threadbag[NUMTHREADS + 1];
void *
mythread(void * arg)
{
- int result = ((int)PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
bag_t * bag = (bag_t *) arg;
assert(bag == &threadbag[bag->threadnum]);
@@ -109,7 +109,7 @@ mythread(void * arg)
pthread_testcancel();
}
- return (void *) result;
+ return result;
}
int
@@ -125,7 +125,7 @@ main()
{
threadbag[i].started = 0;
threadbag[i].threadnum = i;
- assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0);
+ assert(pthread_create(&t[i], NULL, mythread, (void *)(size_t) &threadbag[i]) == 0);
}
/*
@@ -136,7 +136,10 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
assert(pthread_cancel(t[i]) == 0);
- assert(pthread_cancel(t[i]) == 0);
+ if (pthread_cancel(t[i]) != 0)
+ {
+ printf("Second cancelation failed but this is expected sometimes.\n");
+ }
}
/*
@@ -165,11 +168,11 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
- assert(pthread_join(t[i], (void **) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cancel7.c b/pthreads/tests/cancel7.c
index 9fb2e6166..5f1390f7b 100644
--- a/pthreads/tests/cancel7.c
+++ b/pthreads/tests/cancel7.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
@@ -118,7 +118,9 @@ Win32thread(void * arg)
pthread_testcancel();
}
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
return 0;
+#endif
}
int
@@ -188,13 +190,13 @@ main()
/*
* Can't get a result code.
*/
- result = (int) PTHREAD_CANCELED;
+ result = (int)(size_t)PTHREAD_CANCELED;
#endif
assert(threadbag[i].self.p != NULL);
assert(pthread_kill(threadbag[i].self, 0) == ESRCH);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = (result != (int)(size_t)PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cancel8.c b/pthreads/tests/cancel8.c
index 69eafe98e..7204d19b1 100644
--- a/pthreads/tests/cancel8.c
+++ b/pthreads/tests/cancel8.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
@@ -119,7 +119,9 @@ Win32thread(void * arg)
pthread_cond_wait(&CV, &CVLock);
pthread_cleanup_pop(1);
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
return 0;
+#endif
}
int
@@ -189,13 +191,13 @@ main()
/*
* Can't get a result code.
*/
- result = (int) PTHREAD_CANCELED;
+ result = (int)(size_t)PTHREAD_CANCELED;
#endif
assert(threadbag[i].self.p != NULL);
assert(pthread_kill(threadbag[i].self, 0) == ESRCH);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = (result != (int)(size_t)PTHREAD_CANCELED);
if (fail)
{
diff --git a/pthreads/tests/cleanup0.c b/pthreads/tests/cleanup0.c
index 77626eb66..d9fbedccc 100644
--- a/pthreads/tests/cleanup0.c
+++ b/pthreads/tests/cleanup0.c
@@ -137,7 +137,7 @@ mythread(void * arg)
#pragma inline_depth()
#endif
- return (void *) result;
+ return (void *) (size_t)result;
}
int
@@ -189,18 +189,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
- assert(pthread_join(t[i], (void **) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = (result == (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result == (int) PTHREAD_CANCELED);
if (fail)
{
fprintf(stderr, "Thread %d: started %d: result %d\n",
i,
threadbag[i].started,
- result);
+ (int)(size_t)result);
fflush(stderr);
}
failed = (failed || fail);
diff --git a/pthreads/tests/cleanup1.c b/pthreads/tests/cleanup1.c
index 385aed959..30d4940b7 100644
--- a/pthreads/tests/cleanup1.c
+++ b/pthreads/tests/cleanup1.c
@@ -146,7 +146,7 @@ mythread(void * arg)
#pragma inline_depth()
#endif
- return (void *) result;
+ return (void *) (size_t)result;
}
int
@@ -203,18 +203,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
- assert(pthread_join(t[i], (void **) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
if (fail)
{
fprintf(stderr, "Thread %d: started %d: result %d\n",
i,
threadbag[i].started,
- result);
+ (int)(size_t)result);
}
failed = (failed || fail);
}
diff --git a/pthreads/tests/cleanup2.c b/pthreads/tests/cleanup2.c
index 4c639181b..67037c255 100644
--- a/pthreads/tests/cleanup2.c
+++ b/pthreads/tests/cleanup2.c
@@ -131,7 +131,7 @@ mythread(void * arg)
#pragma inline_depth()
#endif
- return (void *) result;
+ return (void *) (size_t)result;
}
int
@@ -178,18 +178,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
- assert(pthread_join(t[i], (void **) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = (result != 0);
+ fail = ((int)(size_t)result != 0);
if (fail)
{
fprintf(stderr, "Thread %d: started %d: result: %d\n",
i,
threadbag[i].started,
- result);
+ (int)(size_t)result);
}
failed = (failed || fail);
}
diff --git a/pthreads/tests/cleanup3.c b/pthreads/tests/cleanup3.c
index b595ab43c..62317b3b0 100644
--- a/pthreads/tests/cleanup3.c
+++ b/pthreads/tests/cleanup3.c
@@ -136,7 +136,7 @@ mythread(void * arg)
#pragma inline_depth()
#endif
- return (void *) result;
+ return (void *) (size_t)result;
}
int
@@ -183,18 +183,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
- assert(pthread_join(t[i], (void **) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = (result != 0);
+ fail = ((int)(size_t)result != 0);
if (fail)
{
fprintf(stderr, "Thread %d: started %d: result: %d\n",
i,
threadbag[i].started,
- result);
+ (int)(size_t)result);
}
failed = (failed || fail);
}
diff --git a/pthreads/tests/condvar1_2.c b/pthreads/tests/condvar1_2.c
index 503e821b6..3d961f06d 100644
--- a/pthreads/tests/condvar1_2.c
+++ b/pthreads/tests/condvar1_2.c
@@ -89,7 +89,7 @@ int
main()
{
int i, j, k;
- int result = -1;
+ void* result = (void*)-1;
pthread_t t;
for (k = 0; k < NUM_LOOPS; k++)
@@ -116,8 +116,8 @@ main()
}
while (j > 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert (result == 0);
+ assert(pthread_join(t, &result) == 0);
+ assert ((int)(size_t)result == 0);
}
return 0;
diff --git a/pthreads/tests/condvar2.c b/pthreads/tests/condvar2.c
index 33f1d3f1d..6e2fa52d2 100644
--- a/pthreads/tests/condvar2.c
+++ b/pthreads/tests/condvar2.c
@@ -87,7 +87,7 @@ int
main()
{
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
@@ -97,9 +97,9 @@ main()
assert(pthread_mutex_lock(&mutex) == 0);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
diff --git a/pthreads/tests/condvar2_1.c b/pthreads/tests/condvar2_1.c
index 92dddfd9a..3486d2110 100644
--- a/pthreads/tests/condvar2_1.c
+++ b/pthreads/tests/condvar2_1.c
@@ -105,8 +105,8 @@ main()
{
int i;
pthread_t t[NUMTHREADS + 1];
- int result = 0;
- struct _timeb currSysTime;
+ void* result = (void*)0;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
@@ -114,9 +114,9 @@ main()
assert(pthread_mutex_init(&mutex, NULL) == 0);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
@@ -125,15 +125,15 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
- assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0);
+ assert(pthread_create(&t[i], NULL, mythread, (void *)(size_t)i) == 0);
}
assert(pthread_mutex_unlock(&mutex) == 0);
for (i = 1; i <= NUMTHREADS; i++)
{
- assert(pthread_join(t[i], (void **) &result) == 0);
- assert(result == i);
+ assert(pthread_join(t[i], &result) == 0);
+ assert((int)(size_t)result == i);
}
{
diff --git a/pthreads/tests/condvar3.c b/pthreads/tests/condvar3.c
index e3a23f54f..056334b37 100644
--- a/pthreads/tests/condvar3.c
+++ b/pthreads/tests/condvar3.c
@@ -112,7 +112,7 @@ main()
{
pthread_t t[NUMTHREADS];
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert((t[0] = pthread_self()).p != NULL);
@@ -124,9 +124,9 @@ main()
assert(pthread_mutex_lock(&mutex) == 0);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0);
diff --git a/pthreads/tests/condvar3_1.c b/pthreads/tests/condvar3_1.c
index 25a50e4bb..33baeb14d 100644
--- a/pthreads/tests/condvar3_1.c
+++ b/pthreads/tests/condvar3_1.c
@@ -126,8 +126,8 @@ main()
{
int i;
pthread_t t[NUMTHREADS + 1];
- int result = 0;
- struct _timeb currSysTime;
+ void* result = (void*)0;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
@@ -137,9 +137,9 @@ main()
assert(pthread_mutex_init(&mutex1, NULL) == 0);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
@@ -148,7 +148,7 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
- assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0);
+ assert(pthread_create(&t[i], NULL, mythread, (void *)(size_t)i) == 0);
}
do {
@@ -168,8 +168,8 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
- assert(pthread_join(t[i], (void **) &result) == 0);
- assert(result == i);
+ assert(pthread_join(t[i], &result) == 0);
+ assert((int)(size_t)result == i);
}
fprintf(stderr, "awk = %d\n", awoken);
diff --git a/pthreads/tests/condvar3_2.c b/pthreads/tests/condvar3_2.c
index 5ddcf5748..4c3580152 100644
--- a/pthreads/tests/condvar3_2.c
+++ b/pthreads/tests/condvar3_2.c
@@ -100,7 +100,7 @@ mythread(void * arg)
abstime2.tv_sec = abstime.tv_sec;
- if ((int) arg % 3 == 0)
+ if ((int) (size_t)arg % 3 == 0)
{
abstime2.tv_sec += 2;
}
@@ -127,8 +127,8 @@ main()
{
int i;
pthread_t t[NUMTHREADS + 1];
- int result = 0;
- struct _timeb currSysTime;
+ void* result = (void*)0;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
@@ -136,24 +136,24 @@ main()
assert(pthread_mutex_init(&mutex, NULL) == 0);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = abstime.tv_sec = currSysTime.time + 5;
+ abstime.tv_sec = abstime2.tv_sec = (long)currSysTime.time + 5;
abstime.tv_nsec = abstime2.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
assert(pthread_mutex_lock(&mutex) == 0);
for (i = 1; i <= NUMTHREADS; i++)
{
- assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0);
+ assert(pthread_create(&t[i], NULL, mythread, (void *)(size_t)i) == 0);
}
assert(pthread_mutex_unlock(&mutex) == 0);
for (i = 1; i <= NUMTHREADS; i++)
{
- assert(pthread_join(t[i], (void **) &result) == 0);
- assert(result == i);
+ assert(pthread_join(t[i], &result) == 0);
+ assert((int)(size_t)result == i);
/*
* Approximately 2/3rds of the threads are expected to time out.
* Signal the remainder after some threads have woken up and exited
diff --git a/pthreads/tests/condvar3_3.c b/pthreads/tests/condvar3_3.c
index fe6763249..f842440a1 100644
--- a/pthreads/tests/condvar3_3.c
+++ b/pthreads/tests/condvar3_3.c
@@ -87,16 +87,16 @@ int main()
int rc;
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cnd, 0) == 0);
assert(pthread_mutex_init(&mtx, 0) == 0);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
@@ -120,7 +120,7 @@ int main()
assert(pthread_mutex_lock(&mtx) == 0);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
diff --git a/pthreads/tests/condvar4.c b/pthreads/tests/condvar4.c
index 3babeeac5..3f6879b0a 100644
--- a/pthreads/tests/condvar4.c
+++ b/pthreads/tests/condvar4.c
@@ -112,7 +112,7 @@ main()
{
pthread_t t[NUMTHREADS];
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
@@ -128,9 +128,9 @@ main()
assert(cvthing.lock != PTHREAD_MUTEX_INITIALIZER);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
@@ -141,9 +141,9 @@ main()
assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0);
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
diff --git a/pthreads/tests/condvar5.c b/pthreads/tests/condvar5.c
index 4d51f396a..73083a55e 100644
--- a/pthreads/tests/condvar5.c
+++ b/pthreads/tests/condvar5.c
@@ -111,7 +111,7 @@ main()
{
pthread_t t[NUMTHREADS];
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
@@ -127,9 +127,9 @@ main()
assert(cvthing.lock != PTHREAD_MUTEX_INITIALIZER);
/* get current system time */
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
@@ -140,9 +140,9 @@ main()
assert(pthread_create(&t[1], NULL, mythread, (void *) 1) == 0);
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
diff --git a/pthreads/tests/condvar6.c b/pthreads/tests/condvar6.c
index e63132c5d..9d0b75d81 100644
--- a/pthreads/tests/condvar6.c
+++ b/pthreads/tests/condvar6.c
@@ -144,7 +144,7 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
@@ -157,9 +157,9 @@ main()
assert(pthread_mutex_lock(&start_flag) == 0);
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
diff --git a/pthreads/tests/condvar7.c b/pthreads/tests/condvar7.c
index 6d89f2ea9..0647e7d91 100644
--- a/pthreads/tests/condvar7.c
+++ b/pthreads/tests/condvar7.c
@@ -154,7 +154,7 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
@@ -167,9 +167,9 @@ main()
assert(pthread_mutex_lock(&start_flag) == 0);
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (time_t)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 10;
diff --git a/pthreads/tests/condvar8.c b/pthreads/tests/condvar8.c
index e384a1c9c..7c2579d98 100644
--- a/pthreads/tests/condvar8.c
+++ b/pthreads/tests/condvar8.c
@@ -155,7 +155,7 @@ main()
int first, last;
pthread_t t[NUMTHREADS + 1];
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert((t[0] = pthread_self()).p != NULL);
@@ -164,9 +164,9 @@ main()
assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER);
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 10;
diff --git a/pthreads/tests/condvar9.c b/pthreads/tests/condvar9.c
index c75127108..62d044bf8 100644
--- a/pthreads/tests/condvar9.c
+++ b/pthreads/tests/condvar9.c
@@ -163,7 +163,7 @@ main()
int canceledThreads = 0;
pthread_t t[NUMTHREADS + 1];
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert((t[0] = pthread_self()).p != NULL);
@@ -172,9 +172,9 @@ main()
assert(cvthing.lock == PTHREAD_MUTEX_INITIALIZER);
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 5;
diff --git a/pthreads/tests/create2.c b/pthreads/tests/create2.c
index 2ffb64e08..9b4e86480 100644
--- a/pthreads/tests/create2.c
+++ b/pthreads/tests/create2.c
@@ -100,7 +100,8 @@ main()
{
washere = 0;
assert(pthread_create(&t, &attr, func, NULL) == 0);
- pthread_join(t, &result);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 0);
assert(washere == 1);
}
diff --git a/pthreads/tests/delay2.c b/pthreads/tests/delay2.c
index 8ecaf0b94..071b837f1 100644
--- a/pthreads/tests/delay2.c
+++ b/pthreads/tests/delay2.c
@@ -58,14 +58,14 @@ func(void * arg)
#pragma inline_depth()
#endif
- return (void *) 1;
+ return (void *)(size_t)1;
}
int
main(int argc, char * argv[])
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_mutex_lock(&mx) == 0);
@@ -74,8 +74,8 @@ main(int argc, char * argv[])
assert(pthread_mutex_unlock(&mx) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result == (int) PTHREAD_CANCELED);
+ assert(pthread_join(t, &result) == 0);
+ assert(result == (void*)PTHREAD_CANCELED);
return 0;
}
diff --git a/pthreads/tests/detach1.c b/pthreads/tests/detach1.c
index 165c8c1d1..89756c7ad 100644
--- a/pthreads/tests/detach1.c
+++ b/pthreads/tests/detach1.c
@@ -46,7 +46,7 @@ enum {
void *
func(void * arg)
{
- int i = (int) arg;
+ int i = (int)(size_t)arg;
Sleep(i * 10);
@@ -65,7 +65,7 @@ main(int argc, char * argv[])
/* Create a few threads and then exit. */
for (i = 0; i < NUMTHREADS; i++)
{
- assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
+ assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0);
}
/* Some threads will finish before they are detached, some after. */
diff --git a/pthreads/tests/exception1.c b/pthreads/tests/exception1.c
index 3f9f59578..62a5a63cb 100644
--- a/pthreads/tests/exception1.c
+++ b/pthreads/tests/exception1.c
@@ -86,7 +86,7 @@ void *
exceptionedThread(void * arg)
{
int dummy = 0;
- int result = ((int)PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
/* Set to async cancelable */
assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0);
@@ -98,7 +98,7 @@ exceptionedThread(void * arg)
#if defined(_MSC_VER) && !defined(__cplusplus)
__try
{
- int zero = (int) arg; /* Passed in from arg to avoid compiler error */
+ int zero = (int) (size_t)arg; /* Passed in from arg to avoid compiler error */
int one = 1;
/*
* The deliberate exception condition (zero divide) is
@@ -110,7 +110,7 @@ exceptionedThread(void * arg)
__except (EXCEPTION_EXECUTE_HANDLER)
{
/* Should get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#elif defined(__cplusplus)
try
@@ -129,17 +129,17 @@ exceptionedThread(void * arg)
#endif
{
/* Should get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#endif
- return (void *) result;
+ return (void *) (size_t)result;
}
void *
canceledThread(void * arg)
{
- int result = ((int)PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
int count;
/* Set to async cancelable */
@@ -161,7 +161,7 @@ canceledThread(void * arg)
__except (EXCEPTION_EXECUTE_HANDLER)
{
/* Should NOT get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#elif defined(__cplusplus)
try
@@ -180,11 +180,11 @@ canceledThread(void * arg)
#endif
{
/* Should NOT get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#endif
- return (void *) result;
+ return (void *) (size_t)result;
}
int
@@ -226,17 +226,17 @@ main()
for (i = 0; i < NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/* Canceled thread */
- assert(pthread_join(ct[i], (void **) &result) == 0);
- assert(!(fail = (result != (int) PTHREAD_CANCELED)));
+ assert(pthread_join(ct[i], &result) == 0);
+ assert(!(fail = (result != PTHREAD_CANCELED)));
failed = (failed || fail);
/* Exceptioned thread */
- assert(pthread_join(et[i], (void **) &result) == 0);
- assert(!(fail = (result != ((int) PTHREAD_CANCELED + 2))));
+ assert(pthread_join(et[i], &result) == 0);
+ assert(!(fail = (result != (void*)((int)(size_t)PTHREAD_CANCELED + 2))));
failed = (failed || fail);
}
diff --git a/pthreads/tests/exception2.c b/pthreads/tests/exception2.c
index 5c1856810..faf677d9b 100644
--- a/pthreads/tests/exception2.c
+++ b/pthreads/tests/exception2.c
@@ -62,7 +62,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
@@ -113,7 +113,7 @@ exceptionedThread(void * arg)
}
int
-main(int argc, char argv[])
+main(int argc, char* argv[])
{
int i;
pthread_t mt;
diff --git a/pthreads/tests/exception3.c b/pthreads/tests/exception3.c
index 9a70a405a..65bcdbef3 100644
--- a/pthreads/tests/exception3.c
+++ b/pthreads/tests/exception3.c
@@ -62,7 +62,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
@@ -101,7 +101,7 @@ terminateFunction ()
{
assert(pthread_mutex_lock(&caughtLock) == 0);
caught++;
-#if 1
+#if 0
{
FILE * fp = fopen("pthread.log", "a");
fprintf(fp, "Caught = %d\n", caught);
@@ -110,18 +110,6 @@ terminateFunction ()
#endif
assert(pthread_mutex_unlock(&caughtLock) == 0);
-#if defined(__MINGW32__)
- /*
- * Seems to work. That is, threads exit and the process
- * continues. Note: need to check correct POSIX behaviour.
- * My guess is: this is because of the
- * eh incompatibility between g++ and MSVC++. That is,
- * an exception thrown in g++ code doesn't propogate
- * through or to MSVC++ code, and vice versa.
- * Applications should probably not depend on this.
- */
- pthread_exit((void *) 0);
-#else
/*
* Notes from the MSVC++ manual:
* 1) A term_func() should call exit(), otherwise
@@ -129,13 +117,12 @@ terminateFunction ()
* 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. Therefore
+ * 2) A term_func() must not throw an exception. Dev: Therefore
* term_func() should not call pthread_exit() if an
- * an exception-using version of pthreads-win32 library
+ * exception-using version of pthreads-win32 library
* is being used (i.e. either pthreadVCE or pthreadVSE).
*/
exit(0);
-#endif
}
void *
@@ -172,7 +159,7 @@ main()
assert(pthread_create(&et[i], NULL, exceptionedThread, NULL) == 0);
}
- Sleep(5000);
+ Sleep(NUMTHREADS * 100);
assert(caught == NUMTHREADS);
diff --git a/pthreads/tests/exit2.c b/pthreads/tests/exit2.c
index 196139a9f..b9f785edf 100644
--- a/pthreads/tests/exit2.c
+++ b/pthreads/tests/exit2.c
@@ -58,7 +58,7 @@ main(int argc, char * argv[])
assert(pthread_create(&t, NULL, func, (void *) NULL) == 0);
- Sleep(1000);
+ Sleep(100);
return 0;
}
diff --git a/pthreads/tests/exit3.c b/pthreads/tests/exit3.c
index 574a92df7..18859e4ee 100644
--- a/pthreads/tests/exit3.c
+++ b/pthreads/tests/exit3.c
@@ -58,10 +58,10 @@ main(int argc, char * argv[])
/* Create a few threads and then exit. */
for (i = 0; i < 4; i++)
{
- assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
+ assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0);
}
- Sleep(1000);
+ Sleep(400);
/* Success. */
return 0;
diff --git a/pthreads/tests/exit4.c b/pthreads/tests/exit4.c
index 1ceca4e35..06dd8b1ee 100644
--- a/pthreads/tests/exit4.c
+++ b/pthreads/tests/exit4.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
@@ -111,7 +111,7 @@ Win32thread(void * arg)
/*
* Doesn't return and doesn't create an implicit POSIX handle.
*/
- pthread_exit((void *) result);
+ pthread_exit((void *)(size_t)result);
return 0;
}
diff --git a/pthreads/tests/exit5.c b/pthreads/tests/exit5.c
index 450ed3bea..ac98f996c 100644
--- a/pthreads/tests/exit5.c
+++ b/pthreads/tests/exit5.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
@@ -115,7 +115,7 @@ Win32thread(void * arg)
/*
* Doesn't return.
*/
- pthread_exit((void *) result);
+ pthread_exit((void *)(size_t)result);
return 0;
}
diff --git a/pthreads/tests/inherit1.c b/pthreads/tests/inherit1.c
index 482a5a884..24ceec557 100644
--- a/pthreads/tests/inherit1.c
+++ b/pthreads/tests/inherit1.c
@@ -89,7 +89,7 @@ void * func(void * arg)
struct sched_param param;
assert(pthread_getschedparam(pthread_self(), &policy, &param) == 0);
- return (void *) param.sched_priority;
+ return (void *) (size_t)param.sched_priority;
}
@@ -169,7 +169,7 @@ main()
assert(pthread_attr_setschedparam(&attr, &param) == 0);
assert(pthread_create(&t, &attr, func, NULL) == 0);
pthread_join(t, &result);
- assert((int) result == mainParam.sched_priority);
+ assert((int)(size_t) result == mainParam.sched_priority);
}
}
diff --git a/pthreads/tests/join0.c b/pthreads/tests/join0.c
index a6cb25dcc..d888e9d6b 100644
--- a/pthreads/tests/join0.c
+++ b/pthreads/tests/join0.c
@@ -53,14 +53,14 @@ int
main(int argc, char * argv[])
{
pthread_t id;
- int result;
+ void* result = (void*)0;
/* Create a single thread and wait for it to exit. */
assert(pthread_create(&id, NULL, func, (void *) 123) == 0);
- assert(pthread_join(id, (void **) &result) == 0);
+ assert(pthread_join(id, &result) == 0);
- assert(result == 123);
+ assert((int)(size_t)result == 123);
/* Success. */
return 0;
diff --git a/pthreads/tests/join1.c b/pthreads/tests/join1.c
index 8b11e9503..337af832d 100644
--- a/pthreads/tests/join1.c
+++ b/pthreads/tests/join1.c
@@ -41,7 +41,7 @@
void *
func(void * arg)
{
- int i = (int) arg;
+ int i = (int)(size_t)arg;
Sleep(i * 100);
@@ -56,12 +56,12 @@ main(int argc, char * argv[])
{
pthread_t id[4];
int i;
- int result;
+ void* result = (void*)-1;
/* Create a few threads and then exit. */
for (i = 0; i < 4; i++)
{
- assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
+ assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0);
}
/* Some threads will finish before they are joined, some after. */
@@ -69,8 +69,8 @@ main(int argc, char * argv[])
for (i = 0; i < 4; i++)
{
- assert(pthread_join(id[i], (void **) &result) == 0);
- assert(result == i);
+ assert(pthread_join(id[i], &result) == 0);
+ assert((int)(size_t)result == i);
}
/* Success. */
diff --git a/pthreads/tests/join2.c b/pthreads/tests/join2.c
index 4fa30129e..b3b85ee81 100644
--- a/pthreads/tests/join2.c
+++ b/pthreads/tests/join2.c
@@ -50,18 +50,18 @@ main(int argc, char * argv[])
{
pthread_t id[4];
int i;
- int result;
+ void* result = (void*)-1;
/* Create a few threads and then exit. */
for (i = 0; i < 4; i++)
{
- assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
+ assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0);
}
for (i = 0; i < 4; i++)
{
- assert(pthread_join(id[i], (void **) &result) == 0);
- assert(result == i);
+ assert(pthread_join(id[i], &result) == 0);
+ assert((int)(size_t)result == i);
}
/* Success. */
diff --git a/pthreads/tests/join3.c b/pthreads/tests/join3.c
index 70cf3e97f..44380ace3 100644
--- a/pthreads/tests/join3.c
+++ b/pthreads/tests/join3.c
@@ -50,12 +50,12 @@ main(int argc, char * argv[])
{
pthread_t id[4];
int i;
- int result;
+ void* result = (void*)-1;
/* Create a few threads and then exit. */
for (i = 0; i < 4; i++)
{
- assert(pthread_create(&id[i], NULL, func, (void *) i) == 0);
+ assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0);
}
/*
@@ -66,8 +66,8 @@ main(int argc, char * argv[])
for (i = 0; i < 4; i++)
{
- assert(pthread_join(id[i], (void **) &result) == 0);
- assert(result == i);
+ assert(pthread_join(id[i], &result) == 0);
+ assert((int)(size_t)result == i);
}
/* Success. */
diff --git a/pthreads/tests/mutex1e.c b/pthreads/tests/mutex1e.c
index e52810728..d32adb3a1 100644
--- a/pthreads/tests/mutex1e.c
+++ b/pthreads/tests/mutex1e.c
@@ -54,6 +54,8 @@ main()
{
assert(pthread_mutexattr_init(&mxAttr) == 0);
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0);
assert(mutex == NULL);
@@ -70,5 +72,7 @@ main()
assert(mutex == NULL);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
return 0;
}
diff --git a/pthreads/tests/mutex1n.c b/pthreads/tests/mutex1n.c
index 74850d6c8..fcfc1347c 100644
--- a/pthreads/tests/mutex1n.c
+++ b/pthreads/tests/mutex1n.c
@@ -54,6 +54,8 @@ main()
{
assert(pthread_mutexattr_init(&mxAttr) == 0);
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0);
assert(mutex == NULL);
@@ -70,5 +72,7 @@ main()
assert(mutex == NULL);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
return 0;
}
diff --git a/pthreads/tests/mutex1r.c b/pthreads/tests/mutex1r.c
index 0666dec0d..15083f27a 100644
--- a/pthreads/tests/mutex1r.c
+++ b/pthreads/tests/mutex1r.c
@@ -54,6 +54,8 @@ main()
{
assert(pthread_mutexattr_init(&mxAttr) == 0);
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0);
assert(mutex == NULL);
@@ -70,5 +72,7 @@ main()
assert(mutex == NULL);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
return 0;
}
diff --git a/pthreads/tests/mutex4.c b/pthreads/tests/mutex4.c
index 547d9cb73..6d36e0aa1 100644
--- a/pthreads/tests/mutex4.c
+++ b/pthreads/tests/mutex4.c
@@ -49,7 +49,7 @@ static pthread_mutex_t mutex1;
void * unlocker(void * arg)
{
- int expectedResult = (int) arg;
+ int expectedResult = (int)(size_t)arg;
wasHere++;
assert(pthread_mutex_unlock(&mutex1) == expectedResult);
@@ -65,35 +65,31 @@ main()
assert(pthread_mutexattr_init(&ma) == 0);
+ BEGIN_MUTEX_STALLED_ROBUST(ma)
+
wasHere = 0;
assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_DEFAULT) == 0);
assert(pthread_mutex_init(&mutex1, &ma) == 0);
assert(pthread_mutex_lock(&mutex1) == 0);
- /*
- * NORMAL (fast) mutexes don't check ownership.
- */
- assert(pthread_create(&t, NULL, unlocker, (void *) 0) == 0);
+ assert(pthread_create(&t, NULL, unlocker, (void *)(size_t)(IS_ROBUST?EPERM:0)) == 0);
assert(pthread_join(t, NULL) == 0);
- assert(pthread_mutex_unlock(&mutex1) == EPERM);
+ assert(pthread_mutex_unlock(&mutex1) == 0);
assert(wasHere == 2);
wasHere = 0;
assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_NORMAL) == 0);
assert(pthread_mutex_init(&mutex1, &ma) == 0);
assert(pthread_mutex_lock(&mutex1) == 0);
- /*
- * NORMAL (fast) mutexes don't check ownership.
- */
- assert(pthread_create(&t, NULL, unlocker, (void *) 0) == 0);
+ assert(pthread_create(&t, NULL, unlocker, (void *)(size_t)(IS_ROBUST?EPERM:0)) == 0);
assert(pthread_join(t, NULL) == 0);
- assert(pthread_mutex_unlock(&mutex1) == EPERM);
+ assert(pthread_mutex_unlock(&mutex1) == 0);
assert(wasHere == 2);
wasHere = 0;
assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0);
assert(pthread_mutex_init(&mutex1, &ma) == 0);
assert(pthread_mutex_lock(&mutex1) == 0);
- assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0);
+ assert(pthread_create(&t, NULL, unlocker, (void *)(size_t) EPERM) == 0);
assert(pthread_join(t, NULL) == 0);
assert(pthread_mutex_unlock(&mutex1) == 0);
assert(wasHere == 2);
@@ -102,10 +98,12 @@ main()
assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE) == 0);
assert(pthread_mutex_init(&mutex1, &ma) == 0);
assert(pthread_mutex_lock(&mutex1) == 0);
- assert(pthread_create(&t, NULL, unlocker, (void *) EPERM) == 0);
+ assert(pthread_create(&t, NULL, unlocker, (void *)(size_t) EPERM) == 0);
assert(pthread_join(t, NULL) == 0);
assert(pthread_mutex_unlock(&mutex1) == 0);
assert(wasHere == 2);
+ END_MUTEX_STALLED_ROBUST(ma)
+
return 0;
}
diff --git a/pthreads/tests/mutex6e.c b/pthreads/tests/mutex6e.c
index 8af9274f2..908a51ba1 100644
--- a/pthreads/tests/mutex6e.c
+++ b/pthreads/tests/mutex6e.c
@@ -53,7 +53,7 @@
#include "test.h"
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -74,10 +74,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_ERRORCHECK);
@@ -86,12 +90,15 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result == 555);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
assert(pthread_mutex_destroy(&mutex) == 0);
+
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
exit(0);
diff --git a/pthreads/tests/mutex6es.c b/pthreads/tests/mutex6es.c
index 0d879c4ea..d4b624959 100644
--- a/pthreads/tests/mutex6es.c
+++ b/pthreads/tests/mutex6es.c
@@ -73,14 +73,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER);
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result == 555);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/pthreads/tests/mutex6n.c b/pthreads/tests/mutex6n.c
index 9b4bbb920..9cb309c2c 100644
--- a/pthreads/tests/mutex6n.c
+++ b/pthreads/tests/mutex6n.c
@@ -49,7 +49,7 @@
#include "test.h"
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -61,6 +61,7 @@ void * locker(void * arg)
/* Should wait here (deadlocked) */
assert(pthread_mutex_lock(&mutex) == 0);
+
lockCount++;
assert(pthread_mutex_unlock(&mutex) == 0);
@@ -74,6 +75,10 @@ main()
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_NORMAL);
@@ -82,19 +87,17 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- Sleep(1000);
+ Sleep(100);
assert(lockCount == 1);
- /*
- * Should succeed even though we don't own the lock
- * because FAST mutexes don't check ownership.
- */
- assert(pthread_mutex_unlock(&mutex) == 0);
+ assert(pthread_mutex_unlock(&mutex) == IS_ROBUST?EPERM:0);
+
+ Sleep (100);
- Sleep (1000);
+ assert(lockCount == IS_ROBUST?1:2);
- assert(lockCount == 2);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
exit(0);
diff --git a/pthreads/tests/mutex6r.c b/pthreads/tests/mutex6r.c
index 4bf853f8d..9d81ad849 100644
--- a/pthreads/tests/mutex6r.c
+++ b/pthreads/tests/mutex6r.c
@@ -52,7 +52,7 @@
#include "test.h"
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -73,10 +73,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_RECURSIVE);
@@ -85,12 +89,15 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result == 555);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
assert(pthread_mutex_destroy(&mutex) == 0);
+
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
exit(0);
diff --git a/pthreads/tests/mutex6rs.c b/pthreads/tests/mutex6rs.c
index 4ebe44ef0..4242fd627 100644
--- a/pthreads/tests/mutex6rs.c
+++ b/pthreads/tests/mutex6rs.c
@@ -72,14 +72,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER);
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result == 555);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/pthreads/tests/mutex7.c b/pthreads/tests/mutex7.c
index 8772b9712..4137c351d 100644
--- a/pthreads/tests/mutex7.c
+++ b/pthreads/tests/mutex7.c
@@ -57,7 +57,7 @@ void * locker(void * arg)
assert(pthread_mutex_trylock(&mutex) == EBUSY);
lockCount++;
assert(pthread_mutex_unlock(&mutex) == 0);
- assert(pthread_mutex_unlock(&mutex) == EPERM);
+ assert(pthread_mutex_unlock(&mutex) == 0);
return 0;
}
diff --git a/pthreads/tests/mutex7e.c b/pthreads/tests/mutex7e.c
index 854789b9b..80981b3e1 100644
--- a/pthreads/tests/mutex7e.c
+++ b/pthreads/tests/mutex7e.c
@@ -53,7 +53,7 @@
#include "test.h"
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -65,7 +65,6 @@ void * locker(void * arg)
assert(pthread_mutex_trylock(&mutex) == EBUSY);
lockCount++;
assert(pthread_mutex_unlock(&mutex) == 0);
- assert(pthread_mutex_unlock(&mutex) == EPERM);
return (void *) 555;
}
@@ -74,10 +73,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_ERRORCHECK);
@@ -86,12 +89,15 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result == 555);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
assert(pthread_mutex_destroy(&mutex) == 0);
+
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
exit(0);
diff --git a/pthreads/tests/mutex7n.c b/pthreads/tests/mutex7n.c
index 174355fca..87ba10a57 100644
--- a/pthreads/tests/mutex7n.c
+++ b/pthreads/tests/mutex7n.c
@@ -49,7 +49,7 @@
#include "test.h"
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -61,7 +61,6 @@ void * locker(void * arg)
assert(pthread_mutex_trylock(&mutex) == EBUSY);
lockCount++;
assert(pthread_mutex_unlock(&mutex) == 0);
- assert(pthread_mutex_unlock(&mutex) == EPERM);
return (void *) 555;
}
@@ -73,6 +72,10 @@ main()
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_NORMAL);
@@ -81,10 +84,14 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- Sleep(1000);
+ Sleep(100);
assert(lockCount == 2);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
+ assert(pthread_mutexattr_destroy(&mxAttr) == 0);
+
exit(0);
/* Never reached */
diff --git a/pthreads/tests/mutex7r.c b/pthreads/tests/mutex7r.c
index f9e5ff0e2..4e4ae8a9a 100644
--- a/pthreads/tests/mutex7r.c
+++ b/pthreads/tests/mutex7r.c
@@ -52,7 +52,7 @@
#include "test.h"
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -73,10 +73,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_RECURSIVE);
@@ -85,12 +89,15 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result == 555);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
assert(pthread_mutex_destroy(&mutex) == 0);
+
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
assert(pthread_mutexattr_destroy(&mxAttr) == 0);
exit(0);
diff --git a/pthreads/tests/mutex8.c b/pthreads/tests/mutex8.c
index 5ca99822e..f2636786c 100644
--- a/pthreads/tests/mutex8.c
+++ b/pthreads/tests/mutex8.c
@@ -44,12 +44,12 @@ static pthread_mutex_t mutex;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
diff --git a/pthreads/tests/mutex8e.c b/pthreads/tests/mutex8e.c
index b99d24edd..a36056673 100644
--- a/pthreads/tests/mutex8e.c
+++ b/pthreads/tests/mutex8e.c
@@ -44,7 +44,7 @@
#include "test.h"
#include <sys/timeb.h>
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -52,12 +52,12 @@ static pthread_mutexattr_t mxAttr;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
@@ -76,6 +76,10 @@ main()
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_ERRORCHECK) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_ERRORCHECK);
@@ -92,6 +96,8 @@ main()
assert(pthread_mutex_unlock(&mutex) == 0);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
return 0;
}
diff --git a/pthreads/tests/mutex8n.c b/pthreads/tests/mutex8n.c
index 3cfdae620..0c6d97d7f 100644
--- a/pthreads/tests/mutex8n.c
+++ b/pthreads/tests/mutex8n.c
@@ -44,7 +44,7 @@
#include "test.h"
#include <sys/timeb.h>
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -52,12 +52,12 @@ static pthread_mutexattr_t mxAttr;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
@@ -76,6 +76,10 @@ main()
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_NORMAL) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_NORMAL);
@@ -92,6 +96,8 @@ main()
assert(pthread_mutex_unlock(&mutex) == 0);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
return 0;
}
diff --git a/pthreads/tests/mutex8r.c b/pthreads/tests/mutex8r.c
index d1328cad9..434b9af8e 100644
--- a/pthreads/tests/mutex8r.c
+++ b/pthreads/tests/mutex8r.c
@@ -44,7 +44,7 @@
#include "test.h"
#include <sys/timeb.h>
-static int lockCount = 0;
+static int lockCount;
static pthread_mutex_t mutex;
static pthread_mutexattr_t mxAttr;
@@ -52,12 +52,12 @@ static pthread_mutexattr_t mxAttr;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
@@ -76,6 +76,10 @@ main()
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
+
+ BEGIN_MUTEX_STALLED_ROBUST(mxAttr)
+
+ lockCount = 0;
assert(pthread_mutexattr_settype(&mxAttr, PTHREAD_MUTEX_RECURSIVE) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
assert(mxType == PTHREAD_MUTEX_RECURSIVE);
@@ -92,6 +96,8 @@ main()
assert(pthread_mutex_unlock(&mutex) == 0);
+ END_MUTEX_STALLED_ROBUST(mxAttr)
+
return 0;
}
diff --git a/pthreads/tests/once2.c b/pthreads/tests/once2.c
index 248ccb1a7..84e3f4bf6 100644
--- a/pthreads/tests/once2.c
+++ b/pthreads/tests/once2.c
@@ -70,11 +70,11 @@ myfunc(void)
void *
mythread(void * arg)
{
- assert(pthread_once(&once[(int) arg], myfunc) == 0);
+ assert(pthread_once(&once[(int)(size_t)arg], myfunc) == 0);
EnterCriticalSection(&numThreads.cs);
numThreads.i++;
LeaveCriticalSection(&numThreads.cs);
- return 0;
+ return (void*)(size_t)0;
}
int
@@ -91,7 +91,7 @@ main()
once[j] = o;
for (i = 0; i < NUM_THREADS; i++)
- assert(pthread_create(&t[i][j], NULL, mythread, (void *) j) == 0);
+ assert(pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j) == 0);
}
for (j = 0; j < NUM_ONCE; j++)
diff --git a/pthreads/tests/once3.c b/pthreads/tests/once3.c
index 291f26019..ef1229043 100644
--- a/pthreads/tests/once3.c
+++ b/pthreads/tests/once3.c
@@ -1,132 +1,132 @@
-/*
- * once3.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
- *
- * --------------------------------------------------------------------------
- *
- * Create several pthread_once objects and channel several threads
- * through each. Make the init_routine cancelable and cancel them with
- * waiters waiting.
- *
- * Depends on API functions:
- * pthread_once()
- * pthread_create()
- * pthread_testcancel()
- * pthread_cancel()
- * pthread_once()
- */
-
-/* #define ASSERT_TRACE */
-
-#include "test.h"
-
-#define NUM_THREADS 100 /* Targeting each once control */
-#define NUM_ONCE 10
-
-pthread_once_t o = PTHREAD_ONCE_INIT;
-pthread_once_t once[NUM_ONCE];
-
-typedef struct {
- int i;
- CRITICAL_SECTION cs;
-} sharedInt_t;
-
-static sharedInt_t numOnce = {0, {0}};
-static sharedInt_t numThreads = {0, {0}};
-
-void
-myfunc(void)
-{
- EnterCriticalSection(&numOnce.cs);
- numOnce.i++;
- assert(numOnce.i > 0);
- 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. */
- pthread_testcancel();
-}
-
-void *
-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.
- */
- assert(pthread_cancel(pthread_self()) == 0);
- assert(pthread_once(&once[(int) arg], myfunc) == 0);
- EnterCriticalSection(&numThreads.cs);
- numThreads.i++;
- LeaveCriticalSection(&numThreads.cs);
- return 0;
-}
-
-int
-main()
-{
- pthread_t t[NUM_THREADS][NUM_ONCE];
- int i, j;
-
- InitializeCriticalSection(&numThreads.cs);
- InitializeCriticalSection(&numOnce.cs);
-
- for (j = 0; j < NUM_ONCE; j++)
- {
- once[j] = o;
-
- for (i = 0; i < NUM_THREADS; i++)
- {
- assert(pthread_create(&t[i][j], NULL, mythread, (void *) j) == 0);
- }
- }
-
- for (j = 0; j < NUM_ONCE; j++)
- for (i = 0; i < NUM_THREADS; i++)
- if (pthread_join(t[i][j], NULL) != 0)
- printf("Join failed for [thread,once] = [%d,%d]\n", i, j);
-
- /*
- * All threads will cancel, none will return normally from
- * pthread_once and so numThreads should never be incremented. However,
- * numOnce should be incremented by every thread (NUM_THREADS*NUM_ONCE).
- */
- assert(numOnce.i == NUM_ONCE * NUM_THREADS);
- assert(numThreads.i == 0);
-
- DeleteCriticalSection(&numOnce.cs);
- DeleteCriticalSection(&numThreads.cs);
-
- return 0;
-}
+/*
+ * once3.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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Create several pthread_once objects and channel several threads
+ * through each. Make the init_routine cancelable and cancel them with
+ * waiters waiting.
+ *
+ * Depends on API functions:
+ * pthread_once()
+ * pthread_create()
+ * pthread_testcancel()
+ * pthread_cancel()
+ * pthread_once()
+ */
+
+/* #define ASSERT_TRACE */
+
+#include "test.h"
+
+#define NUM_THREADS 100 /* Targeting each once control */
+#define NUM_ONCE 10
+
+static pthread_once_t o = PTHREAD_ONCE_INIT;
+static pthread_once_t once[NUM_ONCE];
+
+typedef struct {
+ int i;
+ CRITICAL_SECTION cs;
+} sharedInt_t;
+
+static sharedInt_t numOnce = {0, {0}};
+static sharedInt_t numThreads = {0, {0}};
+
+void
+myfunc(void)
+{
+ EnterCriticalSection(&numOnce.cs);
+ numOnce.i++;
+ assert(numOnce.i > 0);
+ 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. */
+ pthread_testcancel();
+}
+
+void *
+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.
+ */
+ assert(pthread_cancel(pthread_self()) == 0);
+ assert(pthread_once(&once[(int)(size_t)arg], myfunc) == 0);
+ EnterCriticalSection(&numThreads.cs);
+ numThreads.i++;
+ LeaveCriticalSection(&numThreads.cs);
+ return (void*)(size_t)0;
+}
+
+int
+main()
+{
+ pthread_t t[NUM_THREADS][NUM_ONCE];
+ int i, j;
+
+ InitializeCriticalSection(&numThreads.cs);
+ InitializeCriticalSection(&numOnce.cs);
+
+ for (j = 0; j < NUM_ONCE; j++)
+ {
+ once[j] = o;
+
+ for (i = 0; i < NUM_THREADS; i++)
+ {
+ assert(pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j) == 0);
+ }
+ }
+
+ for (j = 0; j < NUM_ONCE; j++)
+ for (i = 0; i < NUM_THREADS; i++)
+ if (pthread_join(t[i][j], NULL) != 0)
+ printf("Join failed for [thread,once] = [%d,%d]\n", i, j);
+
+ /*
+ * All threads will cancel, none will return normally from
+ * pthread_once and so numThreads should never be incremented. However,
+ * numOnce should be incremented by every thread (NUM_THREADS*NUM_ONCE).
+ */
+ assert(numOnce.i == NUM_ONCE * NUM_THREADS);
+ assert(numThreads.i == 0);
+
+ DeleteCriticalSection(&numOnce.cs);
+ DeleteCriticalSection(&numThreads.cs);
+
+ return 0;
+}
diff --git a/pthreads/tests/openmp1.c b/pthreads/tests/openmp1.c
new file mode 100644
index 000000000..ee36e75c8
--- /dev/null
+++ b/pthreads/tests/openmp1.c
@@ -0,0 +1,140 @@
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _OPENMP
+# include <omp.h>
+#endif
+#include <pthread.h>
+
+enum {
+ Size = 10000
+};
+
+const int ShouldSum = (Size-1)*Size/2;
+
+short Verbose = 1;
+
+short ThreadOK[3] = {0,0,0}; // Main, Thread1, Thread2
+
+// Thread
+void *_thread(void* Id) {
+ int i;
+ int x[Size];
+
+#ifdef _OPENMP
+# pragma omp parallel for
+#endif
+ for ( i = 0; i < Size; i++ ) {
+#ifdef _OPENMP
+ 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);
+ }
+#endif
+
+ x[i] = i;
+ }
+
+ int Sum=0;
+ for ( i = 0; i < Size; i++ ) {
+ Sum += x[i];
+ }
+ if (Verbose) {
+#ifdef _OPENMP
+# pragma omp critical
+#endif
+ printf("Id %d : %s : %d(should be %d)\n",(int)Id, __FUNCTION__, Sum,ShouldSum);
+ }
+ if (Sum == ShouldSum) ThreadOK[(int)Id] = 1;
+ return NULL;
+}
+
+// MainThread
+void MainThread() {
+ int i;
+
+#ifdef _OPENMP
+# pragma omp parallel for
+#endif
+ for ( i = 0; i < 4; i++ ) {
+#ifdef _OPENMP
+ int tid = omp_get_thread_num();
+# pragma omp critical
+ printf("Main : tid %d\n",tid);
+ _thread((void *)tid);
+#endif
+ }
+ return;
+}
+
+// Comment in/out for checking the effect of multiple threads.
+#define SPAWN_THREADS
+
+// main
+int main(int argc, char *argv[]) {
+
+ if (argc>1) Verbose = 1;
+
+#ifdef _OPENMP
+ omp_set_nested(-1);
+ printf("%s%s%s\n", "Nested parallel blocks are ", omp_get_nested()?" ":"NOT ", "supported.");
+#endif
+
+ MainThread();
+
+#ifdef SPAWN_THREADS
+ {
+ pthread_t a_thr;
+ pthread_t b_thr;
+ int status;
+
+ printf("%s:%d - %s - a_thr:%p - b_thr:%p\n",
+ __FILE__,__LINE__,__FUNCTION__,a_thr.p,b_thr.p);
+
+ status = pthread_create(&a_thr, NULL, _thread, (void*) 1 );
+ if ( status != 0 ) {
+ printf("Failed to create thread 1\n");
+ return (-1);
+ }
+
+ status = pthread_create(&b_thr, NULL, _thread, (void*) 2 );
+ if ( status != 0 ) {
+ printf("Failed to create thread 2\n");
+ return (-1);
+ }
+
+ status = pthread_join(a_thr, NULL);
+ if ( status != 0 ) {
+ printf("Failed to join thread 1\n");
+ return (-1);
+ }
+ printf("Joined thread1\n");
+
+ status = pthread_join(b_thr, NULL);
+ if ( status != 0 ) {
+ printf("Failed to join thread 2\n");
+ return (-1);
+ }
+ printf("Joined thread2\n");
+ }
+#endif // SPAWN_THREADS
+
+ short OK = 0;
+ // Check that we have OpenMP before declaring things OK formally.
+#ifdef _OPENMP
+ OK = 1;
+ {
+ short i;
+ for (i=0;i<3;i++) OK &= ThreadOK[i];
+ }
+ if (OK) printf("OMP : All looks good\n");
+ else printf("OMP : Error\n");
+#else
+ printf("OpenMP seems not enabled ...\n");
+#endif
+
+ return OK?0:1;
+}
+
+//g++ -fopenmp omp_test.c -o omp_test -lpthread
+
diff --git a/pthreads/tests/priority1.c b/pthreads/tests/priority1.c
index c270e998a..40316cc64 100644
--- a/pthreads/tests/priority1.c
+++ b/pthreads/tests/priority1.c
@@ -91,7 +91,7 @@ func(void * arg)
assert(pthread_getschedparam(threadID, &policy, &param) == 0);
assert(policy == SCHED_OTHER);
- return (void *) (param.sched_priority);
+ return (void *) (size_t)(param.sched_priority);
}
void *
@@ -164,8 +164,8 @@ main()
assert(pthread_join(t, &result) == 0);
- assert(param.sched_priority == (int) result);
- printf("%10d %10d %10d\n", param.sched_priority, (int) result, prio);
+ assert(param.sched_priority == (int)(size_t) result);
+ printf("%10d %10d %10d\n", param.sched_priority, (int)(size_t) result, prio);
}
return 0;
diff --git a/pthreads/tests/priority2.c b/pthreads/tests/priority2.c
index a5575abe9..7d4648f90 100644
--- a/pthreads/tests/priority2.c
+++ b/pthreads/tests/priority2.c
@@ -95,7 +95,7 @@ void * func(void * arg)
assert(policy == SCHED_OTHER);
result = pthread_barrier_wait(&endBarrier);
assert(result == 0 || result == PTHREAD_BARRIER_SERIAL_THREAD);
- return (void *) param.sched_priority;
+ return (void *) (size_t)param.sched_priority;
}
@@ -162,7 +162,7 @@ main()
assert(GetThreadPriority(pthread_getw32threadhandle_np(t)) ==
validPriorities[param.sched_priority+(PTW32TEST_MAXPRIORITIES/2)]);
pthread_join(t, &result);
- assert(param.sched_priority == (int)result);
+ assert(param.sched_priority == (int)(size_t)result);
}
return 0;
diff --git a/pthreads/tests/reuse1.c b/pthreads/tests/reuse1.c
index ae9efe400..1a7dff0e0 100644
--- a/pthreads/tests/reuse1.c
+++ b/pthreads/tests/reuse1.c
@@ -100,16 +100,16 @@ main()
washere = 0;
assert(pthread_create(&t, &attr, func, NULL) == 0);
assert(pthread_join(t, &result) == 0);;
- assert(result == 0);
+ assert((int)(size_t)result == 0);
assert(washere == 1);
last_t = t;
for (i = 1; i < NUMTHREADS; i++)
{
washere = 0;
- assert(pthread_create(&t, &attr, func, (void *) i) == 0);
+ assert(pthread_create(&t, &attr, func, (void *)(size_t)i) == 0);
pthread_join(t, &result);
- assert((int) result == i);
+ assert((int)(size_t) result == i);
assert(washere == 1);
/* thread IDs should be unique */
assert(!pthread_equal(t, last_t));
diff --git a/pthreads/tests/reuse2.c b/pthreads/tests/reuse2.c
index c4db81199..362e547d9 100644
--- a/pthreads/tests/reuse2.c
+++ b/pthreads/tests/reuse2.c
@@ -111,7 +111,8 @@ main()
for (i = 0; i < NUMTHREADS; i++)
{
- assert(pthread_create(&t[i], &attr, func, NULL) == 0);
+ while(pthread_create(&t[i], &attr, func, NULL) != 0)
+ Sleep(1);
}
while (NUMTHREADS > InterlockedExchangeAdd((LPLONG)&done, 0L))
diff --git a/pthreads/tests/robust1.c b/pthreads/tests/robust1.c
new file mode 100644
index 000000000..100a8545b
--- /dev/null
+++ b/pthreads/tests/robust1.c
@@ -0,0 +1,141 @@
+/*
+ * robust1.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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * For all robust mutex types.
+ * Thread A locks mutex
+ * Thread A terminates with no threads waiting on robust mutex
+ * Thread B acquires (inherits) mutex and unlocks
+ * Main attempts to lock mutex with unrecovered state.
+ *
+ * Depends on API functions:
+ * pthread_create()
+ * pthread_join()
+ * pthread_mutex_init()
+ * pthread_mutex_lock()
+ * pthread_mutex_unlock()
+ * pthread_mutex_destroy()
+ * pthread_mutexattr_init()
+ * pthread_mutexattr_setrobust()
+ * pthread_mutexattr_settype()
+ * pthread_mutexattr_destroy()
+ */
+
+#include "test.h"
+
+static int lockCount;
+
+static pthread_mutex_t mutex;
+
+void * owner(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex) == 0);
+ lockCount++;
+
+ return 0;
+}
+
+void * inheritor(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_unlock(&mutex) == 0);
+
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t to, ti;
+ pthread_mutexattr_t ma;
+
+ assert(pthread_mutexattr_init(&ma) == 0);
+ assert(pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST) == 0);
+
+ /* Default (NORMAL) type */
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_unlock(&mutex) == EPERM);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* NORMAL type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_NORMAL) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_unlock(&mutex) == EPERM);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* ERRORCHECK type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_unlock(&mutex) == EPERM);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* RECURSIVE type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_unlock(&mutex) == EPERM);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ assert(pthread_mutexattr_destroy(&ma) == 0);
+
+ return 0;
+}
diff --git a/pthreads/tests/robust2.c b/pthreads/tests/robust2.c
new file mode 100644
index 000000000..2b3917a6e
--- /dev/null
+++ b/pthreads/tests/robust2.c
@@ -0,0 +1,143 @@
+/*
+ * robust2.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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * For all robust mutex types.
+ * Thread A locks mutex
+ * Thread B blocks on mutex
+ * Thread A terminates with threads waiting on robust mutex
+ * Thread B awakes and inherits mutex and unlocks
+ * Main attempts to lock mutex with unrecovered state.
+ *
+ * Depends on API functions:
+ * pthread_create()
+ * pthread_join()
+ * pthread_mutex_init()
+ * pthread_mutex_lock()
+ * pthread_mutex_unlock()
+ * pthread_mutex_destroy()
+ * pthread_mutexattr_init()
+ * pthread_mutexattr_setrobust()
+ * pthread_mutexattr_settype()
+ * pthread_mutexattr_destroy()
+ */
+
+#include "test.h"
+
+static int lockCount;
+
+static pthread_mutex_t mutex;
+
+void * owner(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex) == 0);
+ lockCount++;
+ Sleep(200);
+
+ return 0;
+}
+
+void * inheritor(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_unlock(&mutex) == 0);
+
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t to, ti;
+ pthread_mutexattr_t ma;
+
+ assert(pthread_mutexattr_init(&ma) == 0);
+ assert(pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST) == 0);
+
+ /* Default (NORMAL) type */
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* NORMAL type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_NORMAL) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* ERRORCHECK type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* RECURSIVE type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == ENOTRECOVERABLE);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ assert(pthread_mutexattr_destroy(&ma) == 0);
+
+ return 0;
+}
diff --git a/pthreads/tests/robust3.c b/pthreads/tests/robust3.c
new file mode 100644
index 000000000..cbf99df73
--- /dev/null
+++ b/pthreads/tests/robust3.c
@@ -0,0 +1,149 @@
+/*
+ * robust3.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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * For all robust mutex types.
+ * Thread A locks mutex
+ * Thread B blocks on mutex
+ * Thread A terminates with threads waiting on robust mutex
+ * Thread B awakes and inherits mutex, sets consistent and unlocks
+ * Main acquires mutex with recovered state.
+ *
+ * Depends on API functions:
+ * pthread_create()
+ * pthread_join()
+ * pthread_mutex_init()
+ * pthread_mutex_lock()
+ * pthread_mutex_unlock()
+ * pthread_mutex_consistent()
+ * pthread_mutex_destroy()
+ * pthread_mutexattr_init()
+ * pthread_mutexattr_setrobust()
+ * pthread_mutexattr_settype()
+ * pthread_mutexattr_destroy()
+ */
+
+#include "test.h"
+
+static int lockCount;
+
+static pthread_mutex_t mutex;
+
+void * owner(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex) == 0);
+ lockCount++;
+ Sleep(200);
+
+ return 0;
+}
+
+void * inheritor(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_consistent(&mutex) == 0);
+ assert(pthread_mutex_unlock(&mutex) == 0);
+
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t to, ti;
+ pthread_mutexattr_t ma;
+
+ assert(pthread_mutexattr_init(&ma) == 0);
+ assert(pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST) == 0);
+
+ /* Default (NORMAL) type */
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == 0);
+ assert(pthread_mutex_unlock(&mutex) == 0);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* NORMAL type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_NORMAL) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == 0);
+ assert(pthread_mutex_unlock(&mutex) == 0);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* ERRORCHECK type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == 0);
+ assert(pthread_mutex_unlock(&mutex) == 0);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ /* RECURSIVE type */
+ lockCount = 0;
+ assert(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE) == 0);
+ assert(pthread_mutex_init(&mutex, &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 2);
+ assert(pthread_mutex_lock(&mutex) == 0);
+ assert(pthread_mutex_unlock(&mutex) == 0);
+ assert(pthread_mutex_destroy(&mutex) == 0);
+
+ assert(pthread_mutexattr_destroy(&ma) == 0);
+
+ return 0;
+}
diff --git a/pthreads/tests/robust4.c b/pthreads/tests/robust4.c
new file mode 100644
index 000000000..136a183bd
--- /dev/null
+++ b/pthreads/tests/robust4.c
@@ -0,0 +1,199 @@
+/*
+ * robust4.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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Thread A locks multiple robust mutexes
+ * Thread B blocks on same mutexes in different orderings
+ * Thread A terminates with thread waiting on mutexes
+ * Thread B awakes and inherits each mutex in turn, sets consistent and unlocks
+ * Main acquires mutexes with recovered state.
+ *
+ * Depends on API functions:
+ * pthread_create()
+ * pthread_join()
+ * pthread_mutex_init()
+ * pthread_mutex_lock()
+ * pthread_mutex_unlock()
+ * pthread_mutex_destroy()
+ * pthread_mutexattr_init()
+ * pthread_mutexattr_setrobust()
+ * pthread_mutexattr_settype()
+ * pthread_mutexattr_destroy()
+ */
+
+#include "test.h"
+
+static int lockCount;
+
+static pthread_mutex_t mutex[3];
+
+void * owner(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex[0]) == 0);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[1]) == 0);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[2]) == 0);
+ lockCount++;
+ Sleep(200);
+
+ return 0;
+}
+
+void * inheritor(void * arg)
+{
+ int* o = (int*)arg;
+
+ assert(pthread_mutex_lock(&mutex[o[0]]) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[o[1]]) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[o[2]]) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_consistent(&mutex[o[2]]) == 0);
+ assert(pthread_mutex_consistent(&mutex[o[1]]) == 0);
+ assert(pthread_mutex_consistent(&mutex[o[0]]) == 0);
+ assert(pthread_mutex_unlock(&mutex[o[2]]) == 0);
+ assert(pthread_mutex_unlock(&mutex[o[1]]) == 0);
+ assert(pthread_mutex_unlock(&mutex[o[0]]) == 0);
+
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t to, ti;
+ pthread_mutexattr_t ma;
+ int order[3];
+
+ assert(pthread_mutexattr_init(&ma) == 0);
+ assert(pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST) == 0);
+
+ order[0]=0;
+ order[1]=1;
+ order[2]=2;
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex[0], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[1], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[2], &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, (void *)order) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 6);
+ assert(pthread_mutex_lock(&mutex[0]) == 0);
+ assert(pthread_mutex_unlock(&mutex[0]) == 0);
+ assert(pthread_mutex_destroy(&mutex[0]) == 0);
+ assert(pthread_mutex_lock(&mutex[1]) == 0);
+ assert(pthread_mutex_unlock(&mutex[1]) == 0);
+ assert(pthread_mutex_destroy(&mutex[1]) == 0);
+ assert(pthread_mutex_lock(&mutex[2]) == 0);
+ assert(pthread_mutex_unlock(&mutex[2]) == 0);
+ assert(pthread_mutex_destroy(&mutex[2]) == 0);
+
+ order[0]=1;
+ order[1]=0;
+ order[2]=2;
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex[0], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[1], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[2], &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, (void *)order) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 6);
+ assert(pthread_mutex_lock(&mutex[0]) == 0);
+ assert(pthread_mutex_unlock(&mutex[0]) == 0);
+ assert(pthread_mutex_destroy(&mutex[0]) == 0);
+ assert(pthread_mutex_lock(&mutex[1]) == 0);
+ assert(pthread_mutex_unlock(&mutex[1]) == 0);
+ assert(pthread_mutex_destroy(&mutex[1]) == 0);
+ assert(pthread_mutex_lock(&mutex[2]) == 0);
+ assert(pthread_mutex_unlock(&mutex[2]) == 0);
+ assert(pthread_mutex_destroy(&mutex[2]) == 0);
+
+ order[0]=0;
+ order[1]=2;
+ order[2]=1;
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex[0], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[1], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[2], &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, (void *)order) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 6);
+ assert(pthread_mutex_lock(&mutex[0]) == 0);
+ assert(pthread_mutex_unlock(&mutex[0]) == 0);
+ assert(pthread_mutex_destroy(&mutex[0]) == 0);
+ assert(pthread_mutex_lock(&mutex[1]) == 0);
+ assert(pthread_mutex_unlock(&mutex[1]) == 0);
+ assert(pthread_mutex_destroy(&mutex[1]) == 0);
+ assert(pthread_mutex_lock(&mutex[2]) == 0);
+ assert(pthread_mutex_unlock(&mutex[2]) == 0);
+ assert(pthread_mutex_destroy(&mutex[2]) == 0);
+
+ order[0]=2;
+ order[1]=1;
+ order[2]=0;
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex[0], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[1], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[2], &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ Sleep(100);
+ assert(pthread_create(&ti, NULL, inheritor, (void *)order) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 6);
+ assert(pthread_mutex_lock(&mutex[0]) == 0);
+ assert(pthread_mutex_unlock(&mutex[0]) == 0);
+ assert(pthread_mutex_destroy(&mutex[0]) == 0);
+ assert(pthread_mutex_lock(&mutex[1]) == 0);
+ assert(pthread_mutex_unlock(&mutex[1]) == 0);
+ assert(pthread_mutex_destroy(&mutex[1]) == 0);
+ assert(pthread_mutex_lock(&mutex[2]) == 0);
+ assert(pthread_mutex_unlock(&mutex[2]) == 0);
+ assert(pthread_mutex_destroy(&mutex[2]) == 0);
+
+ assert(pthread_mutexattr_destroy(&ma) == 0);
+
+ return 0;
+}
diff --git a/pthreads/tests/robust5.c b/pthreads/tests/robust5.c
new file mode 100644
index 000000000..c67d12482
--- /dev/null
+++ b/pthreads/tests/robust5.c
@@ -0,0 +1,120 @@
+/*
+ * robust5.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
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Thread A locks multiple robust mutexes
+ * Thread B blocks on same mutexes
+ * Thread A terminates with thread waiting on mutexes
+ * Thread B awakes and inherits each mutex in turn
+ * Thread B terminates leaving orphaned mutexes
+ * Main inherits mutexes, sets consistent and unlocks.
+ *
+ * Depends on API functions:
+ * pthread_create()
+ * pthread_join()
+ * pthread_mutex_init()
+ * pthread_mutex_lock()
+ * pthread_mutex_unlock()
+ * pthread_mutex_destroy()
+ * pthread_mutexattr_init()
+ * pthread_mutexattr_setrobust()
+ * pthread_mutexattr_settype()
+ * pthread_mutexattr_destroy()
+ */
+
+#include "test.h"
+
+static int lockCount;
+
+static pthread_mutex_t mutex[3];
+
+void * owner(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex[0]) == 0);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[1]) == 0);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[2]) == 0);
+ lockCount++;
+
+ return 0;
+}
+
+void * inheritor(void * arg)
+{
+ assert(pthread_mutex_lock(&mutex[0]) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[1]) == EOWNERDEAD);
+ lockCount++;
+ assert(pthread_mutex_lock(&mutex[2]) == EOWNERDEAD);
+ lockCount++;
+
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t to, ti;
+ pthread_mutexattr_t ma;
+
+ assert(pthread_mutexattr_init(&ma) == 0);
+ assert(pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST) == 0);
+
+ lockCount = 0;
+ assert(pthread_mutex_init(&mutex[0], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[1], &ma) == 0);
+ assert(pthread_mutex_init(&mutex[2], &ma) == 0);
+ assert(pthread_create(&to, NULL, owner, NULL) == 0);
+ assert(pthread_join(to, NULL) == 0);
+ assert(pthread_create(&ti, NULL, inheritor, NULL) == 0);
+ assert(pthread_join(ti, NULL) == 0);
+ assert(lockCount == 6);
+ assert(pthread_mutex_lock(&mutex[0]) == EOWNERDEAD);
+ assert(pthread_mutex_consistent(&mutex[0]) == 0);
+ assert(pthread_mutex_unlock(&mutex[0]) == 0);
+ assert(pthread_mutex_destroy(&mutex[0]) == 0);
+ assert(pthread_mutex_lock(&mutex[1]) == EOWNERDEAD);
+ assert(pthread_mutex_consistent(&mutex[1]) == 0);
+ assert(pthread_mutex_unlock(&mutex[1]) == 0);
+ assert(pthread_mutex_destroy(&mutex[1]) == 0);
+ assert(pthread_mutex_lock(&mutex[2]) == EOWNERDEAD);
+ assert(pthread_mutex_consistent(&mutex[2]) == 0);
+ assert(pthread_mutex_unlock(&mutex[2]) == 0);
+ assert(pthread_mutex_destroy(&mutex[2]) == 0);
+
+ assert(pthread_mutexattr_destroy(&ma) == 0);
+
+ return 0;
+}
diff --git a/pthreads/tests/rwlock2_t.c b/pthreads/tests/rwlock2_t.c
index 8e6ab6da0..4267ddbc8 100644
--- a/pthreads/tests/rwlock2_t.c
+++ b/pthreads/tests/rwlock2_t.c
@@ -50,12 +50,12 @@ int
main()
{
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
diff --git a/pthreads/tests/rwlock3.c b/pthreads/tests/rwlock3.c
index 4b22c5a16..d30f04088 100644
--- a/pthreads/tests/rwlock3.c
+++ b/pthreads/tests/rwlock3.c
@@ -37,6 +37,8 @@
* and then unlock it again.
*
* Depends on API functions:
+ * pthread_create()
+ * pthread_join()
* pthread_rwlock_wrlock()
* pthread_rwlock_trywrlock()
* pthread_rwlock_unlock()
@@ -66,7 +68,7 @@ main()
assert(pthread_create(&t, NULL, func, NULL) == 0);
- Sleep(2000);
+ assert(pthread_join(t, NULL) == 0);
assert(pthread_rwlock_unlock(&rwlock1) == 0);
diff --git a/pthreads/tests/rwlock3_t.c b/pthreads/tests/rwlock3_t.c
index bc45abc4d..6419de13e 100644
--- a/pthreads/tests/rwlock3_t.c
+++ b/pthreads/tests/rwlock3_t.c
@@ -63,12 +63,12 @@ main()
{
pthread_t t;
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
diff --git a/pthreads/tests/rwlock4.c b/pthreads/tests/rwlock4.c
index edd9dc2c3..a19a00132 100644
--- a/pthreads/tests/rwlock4.c
+++ b/pthreads/tests/rwlock4.c
@@ -37,6 +37,8 @@
* and then unlock it again.
*
* Depends on API functions:
+ * pthread_create()
+ * pthread_join()
* pthread_rwlock_rdlock()
* pthread_rwlock_trywrlock()
* pthread_rwlock_unlock()
@@ -66,7 +68,7 @@ main()
assert(pthread_create(&t, NULL, func, NULL) == 0);
- Sleep(2000);
+ assert(pthread_join(t, NULL) == 0);
assert(pthread_rwlock_unlock(&rwlock1) == 0);
diff --git a/pthreads/tests/rwlock4_t.c b/pthreads/tests/rwlock4_t.c
index 37ec34fa3..58b3602fb 100644
--- a/pthreads/tests/rwlock4_t.c
+++ b/pthreads/tests/rwlock4_t.c
@@ -63,12 +63,12 @@ main()
{
pthread_t t;
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
diff --git a/pthreads/tests/rwlock5.c b/pthreads/tests/rwlock5.c
index 75b82f32a..3b4054756 100644
--- a/pthreads/tests/rwlock5.c
+++ b/pthreads/tests/rwlock5.c
@@ -37,6 +37,8 @@
* and then unlock it again.
*
* Depends on API functions:
+ * pthread_create()
+ * pthread_join()
* pthread_rwlock_rdlock()
* pthread_rwlock_tryrdlock()
* pthread_rwlock_unlock()
@@ -68,7 +70,7 @@ main()
assert(pthread_create(&t, NULL, func, NULL) == 0);
- Sleep(2000);
+ assert(pthread_join(t, NULL) == 0);
assert(pthread_rwlock_unlock(&rwlock1) == 0);
diff --git a/pthreads/tests/rwlock5_t.c b/pthreads/tests/rwlock5_t.c
index bf473a40e..4a94658fb 100644
--- a/pthreads/tests/rwlock5_t.c
+++ b/pthreads/tests/rwlock5_t.c
@@ -65,12 +65,12 @@ main()
{
pthread_t t;
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
diff --git a/pthreads/tests/rwlock6.c b/pthreads/tests/rwlock6.c
index 22d10db42..f667ce5ce 100644
--- a/pthreads/tests/rwlock6.c
+++ b/pthreads/tests/rwlock6.c
@@ -52,12 +52,12 @@ void * wrfunc(void * arg)
int ba;
assert(pthread_rwlock_wrlock(&rwlock1) == 0);
- Sleep(2000);
+ Sleep(200);
bankAccount += 10;
ba = bankAccount;
assert(pthread_rwlock_unlock(&rwlock1) == 0);
- return ((void *) ba);
+ return ((void *)(size_t)ba);
}
void * rdfunc(void * arg)
@@ -68,7 +68,7 @@ void * rdfunc(void * arg)
ba = bankAccount;
assert(pthread_rwlock_unlock(&rwlock1) == 0);
- return ((void *) ba);
+ return ((void *)(size_t)ba);
}
int
@@ -77,25 +77,25 @@ main()
pthread_t wrt1;
pthread_t wrt2;
pthread_t rdt;
- int wr1Result = 0;
- int wr2Result = 0;
- int rdResult = 0;
+ void* wr1Result = (void*)0;
+ void* wr2Result = (void*)0;
+ void* rdResult = (void*)0;
bankAccount = 0;
assert(pthread_create(&wrt1, NULL, wrfunc, NULL) == 0);
- Sleep(500);
+ Sleep(50);
assert(pthread_create(&rdt, NULL, rdfunc, NULL) == 0);
- Sleep(500);
+ Sleep(50);
assert(pthread_create(&wrt2, NULL, wrfunc, NULL) == 0);
- assert(pthread_join(wrt1, (void **) &wr1Result) == 0);
- assert(pthread_join(rdt, (void **) &rdResult) == 0);
- assert(pthread_join(wrt2, (void **) &wr2Result) == 0);
+ assert(pthread_join(wrt1, &wr1Result) == 0);
+ assert(pthread_join(rdt, &rdResult) == 0);
+ assert(pthread_join(wrt2, &wr2Result) == 0);
- assert(wr1Result == 10);
- assert(rdResult == 10);
- assert(wr2Result == 20);
+ assert((int)(size_t)wr1Result == 10);
+ assert((int)(size_t)rdResult == 10);
+ assert((int)(size_t)wr2Result == 20);
return 0;
}
diff --git a/pthreads/tests/rwlock6_t.c b/pthreads/tests/rwlock6_t.c
index aa38bf564..71cbe220a 100644
--- a/pthreads/tests/rwlock6_t.c
+++ b/pthreads/tests/rwlock6_t.c
@@ -55,29 +55,29 @@ void * wrfunc(void * arg)
bankAccount += 10;
assert(pthread_rwlock_unlock(&rwlock1) == 0);
- return ((void *) bankAccount);
+ return ((void *)(size_t)bankAccount);
}
void * rdfunc(void * arg)
{
int ba = -1;
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
- if ((int) arg == 1)
+ if ((int) (size_t)arg == 1)
{
abstime.tv_sec += 1;
assert(pthread_rwlock_timedrdlock(&rwlock1, &abstime) == ETIMEDOUT);
ba = 0;
}
- else if ((int) arg == 2)
+ else if ((int) (size_t)arg == 2)
{
abstime.tv_sec += 3;
assert(pthread_rwlock_timedrdlock(&rwlock1, &abstime) == 0);
@@ -85,7 +85,7 @@ void * rdfunc(void * arg)
assert(pthread_rwlock_unlock(&rwlock1) == 0);
}
- return ((void *) ba);
+ return ((void *)(size_t)ba);
}
int
@@ -95,30 +95,30 @@ main()
pthread_t wrt2;
pthread_t rdt1;
pthread_t rdt2;
- int wr1Result = 0;
- int wr2Result = 0;
- int rd1Result = 0;
- int rd2Result = 0;
+ void* wr1Result = (void*)0;
+ void* wr2Result = (void*)0;
+ void* rd1Result = (void*)0;
+ void* rd2Result = (void*)0;
bankAccount = 0;
assert(pthread_create(&wrt1, NULL, wrfunc, NULL) == 0);
Sleep(500);
- assert(pthread_create(&rdt1, NULL, rdfunc, (void *) 1) == 0);
+ assert(pthread_create(&rdt1, NULL, rdfunc, (void *)(size_t)1) == 0);
Sleep(500);
assert(pthread_create(&wrt2, NULL, wrfunc, NULL) == 0);
Sleep(500);
- assert(pthread_create(&rdt2, NULL, rdfunc, (void *) 2) == 0);
+ assert(pthread_create(&rdt2, NULL, rdfunc, (void *)(size_t)2) == 0);
- assert(pthread_join(wrt1, (void **) &wr1Result) == 0);
- assert(pthread_join(rdt1, (void **) &rd1Result) == 0);
- assert(pthread_join(wrt2, (void **) &wr2Result) == 0);
- assert(pthread_join(rdt2, (void **) &rd2Result) == 0);
+ assert(pthread_join(wrt1, &wr1Result) == 0);
+ assert(pthread_join(rdt1, &rd1Result) == 0);
+ assert(pthread_join(wrt2, &wr2Result) == 0);
+ assert(pthread_join(rdt2, &rd2Result) == 0);
- assert(wr1Result == 10);
- assert(rd1Result == 0);
- assert(wr2Result == 20);
- assert(rd2Result == 20);
+ assert((int)(size_t)wr1Result == 10);
+ assert((int)(size_t)rd1Result == 0);
+ assert((int)(size_t)wr2Result == 20);
+ assert((int)(size_t)rd2Result == 20);
return 0;
}
diff --git a/pthreads/tests/rwlock6_t2.c b/pthreads/tests/rwlock6_t2.c
index 58bfc3d94..b8b0df9f2 100644
--- a/pthreads/tests/rwlock6_t2.c
+++ b/pthreads/tests/rwlock6_t2.c
@@ -54,21 +54,21 @@ void * wrfunc(void * arg)
int result;
result = pthread_rwlock_timedwrlock(&rwlock1, &abstime);
- if ((int) arg == 1)
+ if ((int) (size_t)arg == 1)
{
assert(result == 0);
Sleep(2000);
bankAccount += 10;
assert(pthread_rwlock_unlock(&rwlock1) == 0);
- return ((void *) bankAccount);
+ return ((void *)(size_t)bankAccount);
}
- else if ((int) arg == 2)
+ else if ((int) (size_t)arg == 2)
{
assert(result == ETIMEDOUT);
return ((void *) 100);
}
- return ((void *) -1);
+ return ((void *)(size_t)-1);
}
void * rdfunc(void * arg)
@@ -77,7 +77,7 @@ void * rdfunc(void * arg)
assert(pthread_rwlock_timedrdlock(&rwlock1, &abstime) == ETIMEDOUT);
- return ((void *) ba);
+ return ((void *)(size_t)ba);
}
int
@@ -86,34 +86,34 @@ main()
pthread_t wrt1;
pthread_t wrt2;
pthread_t rdt;
- int wr1Result = 0;
- int wr2Result = 0;
- int rdResult = 0;
- struct _timeb currSysTime;
+ void* wr1Result = (void*)0;
+ void* wr2Result = (void*)0;
+ void* rdResult = (void*)0;
+ PTW32_STRUCT_TIMEB currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
- _ftime(&currSysTime);
+ PTW32_FTIME(&currSysTime);
- abstime.tv_sec = currSysTime.time;
+ abstime.tv_sec = (long)currSysTime.time;
abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm;
abstime.tv_sec += 1;
bankAccount = 0;
- assert(pthread_create(&wrt1, NULL, wrfunc, (void *) 1) == 0);
+ assert(pthread_create(&wrt1, NULL, wrfunc, (void *)(size_t)1) == 0);
Sleep(100);
assert(pthread_create(&rdt, NULL, rdfunc, NULL) == 0);
Sleep(100);
- assert(pthread_create(&wrt2, NULL, wrfunc, (void *) 2) == 0);
+ assert(pthread_create(&wrt2, NULL, wrfunc, (void *)(size_t)2) == 0);
- assert(pthread_join(wrt1, (void **) &wr1Result) == 0);
- assert(pthread_join(rdt, (void **) &rdResult) == 0);
- assert(pthread_join(wrt2, (void **) &wr2Result) == 0);
+ assert(pthread_join(wrt1, &wr1Result) == 0);
+ assert(pthread_join(rdt, &rdResult) == 0);
+ assert(pthread_join(wrt2, &wr2Result) == 0);
- assert(wr1Result == 10);
- assert(rdResult == 0);
- assert(wr2Result == 100);
+ assert((int)(size_t)wr1Result == 10);
+ assert((int)(size_t)rdResult == 0);
+ assert((int)(size_t)wr2Result == 100);
return 0;
}
diff --git a/pthreads/tests/rwlock7.c b/pthreads/tests/rwlock7.c
index 91466e4de..69d1a73fd 100644
--- a/pthreads/tests/rwlock7.c
+++ b/pthreads/tests/rwlock7.c
@@ -108,8 +108,8 @@ main (int argc, char *argv[])
int data_updates = 0;
int seed = 1;
- struct _timeb currSysTime1;
- struct _timeb currSysTime2;
+ PTW32_STRUCT_TIMEB currSysTime1;
+ PTW32_STRUCT_TIMEB currSysTime2;
/*
* Initialize the shared data.
@@ -122,7 +122,7 @@ main (int argc, char *argv[])
assert(pthread_rwlock_init (&data[data_count].lock, NULL) == 0);
}
- _ftime(&currSysTime1);
+ PTW32_FTIME(&currSysTime1);
/*
* Create THREADS threads to access shared data.
@@ -135,7 +135,7 @@ main (int argc, char *argv[])
threads[count].seed = 1 + rand_r (&seed) % 71;
assert(pthread_create (&threads[count].thread_id,
- NULL, thread_routine, (void*)&threads[count]) == 0);
+ NULL, thread_routine, (void*)(size_t)&threads[count]) == 0);
}
/*
@@ -187,13 +187,13 @@ main (int argc, char *argv[])
printf ("%d thread updates, %d data updates\n",
thread_updates, data_updates);
- _ftime(&currSysTime2);
+ PTW32_FTIME(&currSysTime2);
printf( "\nstart: %ld/%d, stop: %ld/%d, duration:%ld\n",
- currSysTime1.time,currSysTime1.millitm,
- currSysTime2.time,currSysTime2.millitm,
- (currSysTime2.time*1000+currSysTime2.millitm) -
- (currSysTime1.time*1000+currSysTime1.millitm));
+ (long)currSysTime1.time,currSysTime1.millitm,
+ (long)currSysTime2.time,currSysTime2.millitm,
+ ((long)((currSysTime2.time*1000+currSysTime2.millitm) -
+ (currSysTime1.time*1000+currSysTime1.millitm))));
return 0;
}
diff --git a/pthreads/tests/rwlock8.c b/pthreads/tests/rwlock8.c
index c83a775ce..99c357aab 100644
--- a/pthreads/tests/rwlock8.c
+++ b/pthreads/tests/rwlock8.c
@@ -114,8 +114,8 @@ main (int argc, char *argv[])
int data_updates = 0;
int seed = 1;
- struct _timeb currSysTime1;
- struct _timeb currSysTime2;
+ PTW32_STRUCT_TIMEB currSysTime1;
+ PTW32_STRUCT_TIMEB currSysTime2;
/*
* Initialize the shared data.
@@ -128,7 +128,7 @@ main (int argc, char *argv[])
assert(pthread_rwlock_init (&data[data_count].lock, NULL) == 0);
}
- _ftime(&currSysTime1);
+ PTW32_FTIME(&currSysTime1);
/*
* Create THREADS threads to access shared data.
@@ -141,7 +141,7 @@ main (int argc, char *argv[])
threads[count].seed = 1 + rand_r (&seed) % 71;
assert(pthread_create (&threads[count].thread_id,
- NULL, thread_routine, (void*)&threads[count]) == 0);
+ NULL, thread_routine, (void*)(size_t)&threads[count]) == 0);
}
/*
@@ -193,13 +193,13 @@ main (int argc, char *argv[])
printf ("%d thread updates, %d data updates\n",
thread_updates, data_updates);
- _ftime(&currSysTime2);
+ PTW32_FTIME(&currSysTime2);
printf( "\nstart: %ld/%d, stop: %ld/%d, duration:%ld\n",
- currSysTime1.time,currSysTime1.millitm,
- currSysTime2.time,currSysTime2.millitm,
- (currSysTime2.time*1000+currSysTime2.millitm) -
- (currSysTime1.time*1000+currSysTime1.millitm));
+ (long)currSysTime1.time,currSysTime1.millitm,
+ (long)currSysTime2.time,currSysTime2.millitm,
+ ((long)((currSysTime2.time*1000+currSysTime2.millitm) -
+ (currSysTime1.time*1000+currSysTime1.millitm))));
return 0;
}
diff --git a/pthreads/tests/semaphore1.c b/pthreads/tests/semaphore1.c
index f89a43081..8fc91ee02 100644
--- a/pthreads/tests/semaphore1.c
+++ b/pthreads/tests/semaphore1.c
@@ -86,8 +86,11 @@ thr(void * arg)
if ( result == -1 )
{
int err = errno;
- printf("thread: sem_trywait 1: expecting error %s: got %s\n",
- error_string[EAGAIN], error_string[err]); fflush(stdout);
+ if (err != EAGAIN)
+ {
+ printf("thread: sem_trywait 1: expecting error %s: got %s\n",
+ error_string[EAGAIN], error_string[err]); fflush(stdout);
+ }
assert(err == EAGAIN);
}
else
@@ -99,18 +102,9 @@ thr(void * arg)
assert((result = sem_trywait(&s)) == 0);
- if ( result == -1 )
- {
- perror("thread: sem_trywait 2");
- }
- else
- {
- printf("thread: ok 2\n");
- }
-
assert(sem_post(&s) == 0);
- return 0;
+ return NULL;
}
@@ -119,21 +113,25 @@ main()
{
pthread_t t;
sem_t s;
- int result;
+ void* result1 = (void*)-1;
+ int result2;
assert(pthread_create(&t, NULL, thr, NULL) == 0);
- assert(pthread_join(t, (void **)&result) == 0);
- assert(result == 0);
+ assert(pthread_join(t, &result1) == 0);
+ assert((int)(size_t)result1 == 0);
assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
- assert((result = sem_trywait(&s)) == -1);
+ assert((result2 = sem_trywait(&s)) == -1);
- if ( result == -1 )
+ if (result2 == -1)
{
int err = errno;
- printf("main: sem_trywait 1: expecting error %s: got %s\n",
- error_string[EAGAIN], error_string[err]); fflush(stdout);
+ if (err != EAGAIN)
+ {
+ printf("main: sem_trywait 1: expecting error %s: got %s\n",
+ error_string[EAGAIN], error_string[err]); fflush(stdout);
+ }
assert(err == EAGAIN);
}
else
@@ -141,18 +139,9 @@ main()
printf("main: ok 1\n");
}
- assert((result = sem_post(&s)) == 0);
+ assert((result2 = sem_post(&s)) == 0);
- assert((result = sem_trywait(&s)) == 0);
-
- if ( result == -1 )
- {
- perror("main: sem_trywait 2");
- }
- else
- {
- printf("main: ok 2\n");
- }
+ assert((result2 = sem_trywait(&s)) == 0);
assert(sem_post(&s) == 0);
diff --git a/pthreads/tests/semaphore4.c b/pthreads/tests/semaphore4.c
index 37613ac39..3a28c7b50 100644
--- a/pthreads/tests/semaphore4.c
+++ b/pthreads/tests/semaphore4.c
@@ -94,7 +94,6 @@ main()
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++)
@@ -104,28 +103,23 @@ main()
sched_yield();
assert(sem_getvalue(&s, &value) == 0);
} while (value != -i);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
assert(sem_getvalue(&s, &value) == 0);
assert(-value == MAX_COUNT);
-//printf("value = %d\n", -value); fflush(stdout);
assert(pthread_cancel(t[50]) == 0);
{
- int result;
- assert(pthread_join(t[50], (void **) &result) == 0);
-// printf("result = %d\n", result); fflush(stdout);
+ void* result;
+ assert(pthread_join(t[50], &result) == 0);
}
assert(sem_getvalue(&s, &value) == 0);
-//printf("value = %d\n", -value); fflush(stdout);
assert(-value == (MAX_COUNT - 1));
for (i = MAX_COUNT - 2; i >= 0; i--)
{
assert(sem_post(&s) == 0);
assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
diff --git a/pthreads/tests/semaphore4t.c b/pthreads/tests/semaphore4t.c
index 14a46694c..97bc7f88a 100644
--- a/pthreads/tests/semaphore4t.c
+++ b/pthreads/tests/semaphore4t.c
@@ -94,7 +94,6 @@ main()
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++)
@@ -104,7 +103,6 @@ main()
sched_yield();
assert(sem_getvalue(&s, &value) == 0);
} while (value != -i);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
@@ -119,7 +117,6 @@ main()
{
assert(sem_post(&s) == 0);
assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
diff --git a/pthreads/tests/create3.c b/pthreads/tests/sequence1.c
index 98bd5200e..46388eebd 100644
--- a/pthreads/tests/create3.c
+++ b/pthreads/tests/sequence1.c
@@ -1,12 +1,12 @@
/*
- * File: create3.c
+ * File: sequence1.c
*
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
- * Copyright(C) 1999,2003 Pthreads-win32 contributors
+ * Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
@@ -33,90 +33,110 @@
*
* --------------------------------------------------------------------------
*
- * Test Synopsis: Test passing NULL as thread id arg to pthread_create.
+ * Test Synopsis:
+ * - that unique thread sequence numbers are generated.
+ * - Analyse thread struct reuse.
*
* Test Method (Validation or Falsification):
- * -
+ * -
*
* Requirements Tested:
* -
*
* Features Tested:
- * -
+ * -
*
* Cases Tested:
- * -
+ * -
*
* Description:
- * -
+ * -
*
* Environment:
- * -
+ * - This test is implementation specific
+ * because it uses knowledge of internals that should be
+ * opaque to an application.
*
* Input:
* - None.
*
* Output:
* - File name, Line number, and failed expression on failure.
- * - No output on success.
+ * - analysis output on success.
*
* Assumptions:
- * -
+ * -
*
* Pass Criteria:
- * - Process returns zero exit status.
+ * - unique sequence numbers are generated for every new thread.
*
* Fail Criteria:
- * - Process returns non-zero exit status.
+ * -
*/
-
-#ifdef __GNUC__
-#include <stdlib.h>
-#endif
-
#include "test.h"
/*
- * Create NUMTHREADS threads in addition to the Main thread.
*/
+
enum {
- NUMTHREADS = 1
+ NUMTHREADS = 10000
};
-void *
-threadFunc(void * arg)
+static long done = 0;
+/*
+ * seqmap should have 1 in every element except [0]
+ * Thread sequence numbers start at 1 and we will also
+ * include this main thread so we need NUMTHREADS+2
+ * elements.
+ */
+static UINT64 seqmap[NUMTHREADS+2];
+
+void * func(void * arg)
{
- return (void *) 0;
-}
+ sched_yield();
+ seqmap[(int)pthread_getunique_np(pthread_self())] = 1;
+ InterlockedIncrement(&done);
+ return (void *) 0;
+}
+
int
-main(int argc, char * argv[])
+main()
{
+ pthread_t t[NUMTHREADS];
+ pthread_attr_t attr;
int i;
- pthread_t mt;
- if (argc <= 1)
+ assert(pthread_attr_init(&attr) == 0);
+ assert(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0);
+
+ for (i = 0; i < NUMTHREADS+2; i++)
{
- int result;
+ seqmap[i] = 0;
+ }
- printf("You should see an application memory write error message\n");
- fflush(stdout);
- result = system("create3.exe die");
- exit(0);
+ for (i = 0; i < NUMTHREADS; i++)
+ {
+ if (NUMTHREADS/2 == i)
+ {
+ /* Include this main thread, which will be an implicit pthread_t */
+ seqmap[(int)pthread_getunique_np(pthread_self())] = 1;
+ }
+ assert(pthread_create(&t[i], &attr, func, NULL) == 0);
}
- assert((mt = pthread_self()).p != NULL);
+ while (NUMTHREADS > InterlockedExchangeAdd((LPLONG)&done, 0L))
+ Sleep(100);
- for (i = 0; i < NUMTHREADS; i++)
+ Sleep(100);
+
+ assert(seqmap[0] == 0);
+ for (i = 1; i < NUMTHREADS+2; i++)
{
- assert(pthread_create(NULL, NULL, threadFunc, NULL) == 0);
+ assert(seqmap[i] == 1);
}
- /*
- * Success.
- */
return 0;
}
-
diff --git a/pthreads/tests/sizes.c b/pthreads/tests/sizes.c
index 73c726171..554d0e843 100644
--- a/pthreads/tests/sizes.c
+++ b/pthreads/tests/sizes.c
@@ -8,24 +8,24 @@ main()
{
printf("Sizes of pthreads-win32 structs\n");
printf("-------------------------------\n");
- printf("%30s %4d\n", "pthread_t", sizeof(pthread_t));
- printf("%30s %4d\n", "ptw32_thread_t", sizeof(ptw32_thread_t));
- printf("%30s %4d\n", "pthread_attr_t_", sizeof(struct pthread_attr_t_));
- printf("%30s %4d\n", "sem_t_", sizeof(struct sem_t_));
- printf("%30s %4d\n", "pthread_mutex_t_", sizeof(struct pthread_mutex_t_));
- printf("%30s %4d\n", "pthread_mutexattr_t_", sizeof(struct pthread_mutexattr_t_));
- printf("%30s %4d\n", "pthread_spinlock_t_", sizeof(struct pthread_spinlock_t_));
- printf("%30s %4d\n", "pthread_barrier_t_", sizeof(struct pthread_barrier_t_));
- printf("%30s %4d\n", "pthread_barrierattr_t_", sizeof(struct pthread_barrierattr_t_));
- printf("%30s %4d\n", "pthread_key_t_", sizeof(struct pthread_key_t_));
- printf("%30s %4d\n", "pthread_cond_t_", sizeof(struct pthread_cond_t_));
- printf("%30s %4d\n", "pthread_condattr_t_", sizeof(struct pthread_condattr_t_));
- printf("%30s %4d\n", "pthread_rwlock_t_", sizeof(struct pthread_rwlock_t_));
- printf("%30s %4d\n", "pthread_rwlockattr_t_", sizeof(struct pthread_rwlockattr_t_));
- printf("%30s %4d\n", "pthread_once_t_", sizeof(struct pthread_once_t_));
- printf("%30s %4d\n", "ptw32_cleanup_t", sizeof(struct ptw32_cleanup_t));
- printf("%30s %4d\n", "ptw32_mcs_node_t_", sizeof(struct ptw32_mcs_node_t_));
- printf("%30s %4d\n", "sched_param", sizeof(struct sched_param));
+ printf("%30s %4d\n", "pthread_t", (int)sizeof(pthread_t));
+ printf("%30s %4d\n", "ptw32_thread_t", (int)sizeof(ptw32_thread_t));
+ printf("%30s %4d\n", "pthread_attr_t_", (int)sizeof(struct pthread_attr_t_));
+ printf("%30s %4d\n", "sem_t_", (int)sizeof(struct sem_t_));
+ printf("%30s %4d\n", "pthread_mutex_t_", (int)sizeof(struct pthread_mutex_t_));
+ printf("%30s %4d\n", "pthread_mutexattr_t_", (int)sizeof(struct pthread_mutexattr_t_));
+ printf("%30s %4d\n", "pthread_spinlock_t_", (int)sizeof(struct pthread_spinlock_t_));
+ printf("%30s %4d\n", "pthread_barrier_t_", (int)sizeof(struct pthread_barrier_t_));
+ printf("%30s %4d\n", "pthread_barrierattr_t_", (int)sizeof(struct pthread_barrierattr_t_));
+ printf("%30s %4d\n", "pthread_key_t_", (int)sizeof(struct pthread_key_t_));
+ printf("%30s %4d\n", "pthread_cond_t_", (int)sizeof(struct pthread_cond_t_));
+ printf("%30s %4d\n", "pthread_condattr_t_", (int)sizeof(struct pthread_condattr_t_));
+ printf("%30s %4d\n", "pthread_rwlock_t_", (int)sizeof(struct pthread_rwlock_t_));
+ printf("%30s %4d\n", "pthread_rwlockattr_t_", (int)sizeof(struct pthread_rwlockattr_t_));
+ printf("%30s %4d\n", "pthread_once_t_", (int)sizeof(struct pthread_once_t_));
+ printf("%30s %4d\n", "ptw32_cleanup_t", (int)sizeof(struct ptw32_cleanup_t));
+ printf("%30s %4d\n", "ptw32_mcs_node_t_", (int)sizeof(struct ptw32_mcs_node_t_));
+ printf("%30s %4d\n", "sched_param", (int)sizeof(struct sched_param));
printf("-------------------------------\n");
return 0;
diff --git a/pthreads/tests/spin3.c b/pthreads/tests/spin3.c
index 8c0dae69f..bbf8bfb22 100644
--- a/pthreads/tests/spin3.c
+++ b/pthreads/tests/spin3.c
@@ -46,7 +46,7 @@ static pthread_spinlock_t spin;
void * unlocker(void * arg)
{
- int expectedResult = (int) arg;
+ int expectedResult = (int)(size_t)arg;
wasHere++;
assert(pthread_spin_unlock(&spin) == expectedResult);
@@ -62,9 +62,13 @@ main()
wasHere = 0;
assert(pthread_spin_init(&spin, PTHREAD_PROCESS_PRIVATE) == 0);
assert(pthread_spin_lock(&spin) == 0);
- assert(pthread_create(&t, NULL, unlocker, (void *) 0) == 0);
+ assert(pthread_create(&t, NULL, unlocker, (void*)0) == 0);
assert(pthread_join(t, NULL) == 0);
- assert(pthread_spin_unlock(&spin) == EPERM);
+ /*
+ * Our spinlocks don't record the owner thread so any thread can unlock the spinlock,
+ * but nor is it an error for any thread to unlock a spinlock that is not locked.
+ */
+ assert(pthread_spin_unlock(&spin) == 0);
assert(pthread_spin_destroy(&spin) == 0);
assert(wasHere == 2);
diff --git a/pthreads/tests/spin4.c b/pthreads/tests/spin4.c
index 8386d0956..3a4fd6f24 100644
--- a/pthreads/tests/spin4.c
+++ b/pthreads/tests/spin4.c
@@ -41,8 +41,8 @@
#include <sys/timeb.h>
pthread_spinlock_t lock = PTHREAD_SPINLOCK_INITIALIZER;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+PTW32_STRUCT_TIMEB currSysTimeStart;
+PTW32_STRUCT_TIMEB currSysTimeStop;
#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- (_TStart.time*1000+_TStart.millitm))
@@ -51,22 +51,22 @@ static int washere = 0;
void * func(void * arg)
{
- _ftime(&currSysTimeStart);
+ PTW32_FTIME(&currSysTimeStart);
washere = 1;
assert(pthread_spin_lock(&lock) == 0);
assert(pthread_spin_unlock(&lock) == 0);
- _ftime(&currSysTimeStop);
+ PTW32_FTIME(&currSysTimeStop);
- return (void *) GetDurationMilliSecs(currSysTimeStart, currSysTimeStop);
+ return (void *)(size_t)GetDurationMilliSecs(currSysTimeStart, currSysTimeStop);
}
int
main()
{
- long result = 0;
+ void* result = (void*)0;
pthread_t t;
int CPUs;
- struct _timeb sysTime;
+ PTW32_STRUCT_TIMEB sysTime;
if ((CPUs = pthread_num_processors_np()) == 1)
{
@@ -86,14 +86,14 @@ main()
do
{
sched_yield();
- _ftime(&sysTime);
+ PTW32_FTIME(&sysTime);
}
while (GetDurationMilliSecs(currSysTimeStart, sysTime) <= 1000);
assert(pthread_spin_unlock(&lock) == 0);
- assert(pthread_join(t, (void **) &result) == 0);
- assert(result > 1000);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result > 1000);
assert(pthread_spin_destroy(&lock) == 0);
diff --git a/pthreads/tests/stress1.c b/pthreads/tests/stress1.c
index ac882503c..7c787dcfb 100644
--- a/pthreads/tests/stress1.c
+++ b/pthreads/tests/stress1.c
@@ -1,278 +1,278 @@
-/*
- * stress1.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:
- * - Stress test condition variables, mutexes, semaphores.
- *
- * Test Method (Validation or Falsification):
- * - Validation
- *
- * Requirements Tested:
- * - Correct accounting of semaphore and condition variable waiters.
- *
- * Features Tested:
- * -
- *
- * Cases Tested:
- * -
- *
- * Description:
- * Attempting to expose race conditions in cond vars, semaphores etc.
- * - Master attempts to signal slave close to when timeout is due.
- * - Master and slave do battle continuously until main tells them to stop.
- * - Afterwards, the CV must be successfully destroyed (will return an
- * error if there are waiters (including any internal semaphore waiters,
- * which, if there are, cannot be real waiters).
- *
- * Environment:
- * -
- *
- * Input:
- * - None.
- *
- * Output:
- * - File name, Line number, and failed expression on failure.
- * - No output on success.
- *
- * Assumptions:
- * -
- *
- * Pass Criteria:
- * - CV is successfully destroyed.
- *
- * Fail Criteria:
- * - CV destroy fails.
- */
-
-#include "test.h"
-#include <string.h>
-#include <sys/timeb.h>
-
-
-const unsigned int ITERATIONS = 1000;
-
-static pthread_t master, slave;
-typedef struct {
- int value;
- pthread_cond_t cv;
- pthread_mutex_t mx;
-} mysig_t;
-
-static int allExit;
-static mysig_t control = {0, PTHREAD_COND_INITIALIZER, PTHREAD_MUTEX_INITIALIZER};
-static pthread_barrier_t startBarrier, readyBarrier, holdBarrier;
-static int timeoutCount = 0;
-static int signalsTakenCount = 0;
-static int signalsSent = 0;
-static int bias = 0;
-static int timeout = 10; // Must be > 0
-
-enum {
- CTL_STOP = -1
-};
-
-/*
- * Returns abstime 'milliseconds' from 'now'.
- *
- * Works for: -INT_MAX <= millisecs <= INT_MAX
- */
-struct timespec *
-millisecondsFromNow (struct timespec * time, int millisecs)
-{
- struct _timeb currSysTime;
- int64_t nanosecs, secs;
- const int64_t NANOSEC_PER_MILLISEC = 1000000;
- const int64_t NANOSEC_PER_SEC = 1000000000;
-
- /* get current system time and add millisecs */
- _ftime(&currSysTime);
-
- secs = (int64_t)(currSysTime.time) + (millisecs / 1000);
- nanosecs = ((int64_t) (millisecs%1000 + currSysTime.millitm)) * NANOSEC_PER_MILLISEC;
- if (nanosecs >= NANOSEC_PER_SEC)
- {
- secs++;
- nanosecs -= NANOSEC_PER_SEC;
- }
- else if (nanosecs < 0)
- {
- secs--;
- nanosecs += NANOSEC_PER_SEC;
- }
-
- time->tv_nsec = (long)nanosecs;
- time->tv_sec = (long)secs;
-
- return time;
-}
-
-void *
-masterThread (void * arg)
-{
- int dither = (int) arg;
-
- timeout = (int) arg;
-
- pthread_barrier_wait(&startBarrier);
-
- do
- {
- int sleepTime;
-
- assert(pthread_mutex_lock(&control.mx) == 0);
- control.value = timeout;
- assert(pthread_mutex_unlock(&control.mx) == 0);
-
- /*
- * We are attempting to send the signal close to when the slave
- * is due to timeout. We feel around by adding some [non-random] dither.
- *
- * dither is in the range 2*timeout peak-to-peak
- * sleep time is the average of timeout plus dither.
- * e.g.
- * if timeout = 10 then dither = 20 and
- * sleep millisecs is: 5 <= ms <= 15
- *
- * The bias value attempts to apply some negative feedback to keep
- * the ratio of timeouts to signals taken close to 1:1.
- * bias changes more slowly than dither so as to average more.
- *
- * Finally, if abs(bias) exceeds timeout then timeout is incremented.
- */
- if (signalsSent % timeout == 0)
- {
- if (timeoutCount > signalsTakenCount)
- {
- bias++;
- }
- else if (timeoutCount < signalsTakenCount)
- {
- bias--;
- }
- if (bias < -timeout || bias > timeout)
- {
- timeout++;
- }
- }
- dither = (dither + 1 ) % (timeout * 2);
- sleepTime = (timeout - bias + dither) / 2;
- Sleep(sleepTime);
- assert(pthread_cond_signal(&control.cv) == 0);
- signalsSent++;
-
- pthread_barrier_wait(&holdBarrier);
- pthread_barrier_wait(&readyBarrier);
- }
- while (!allExit);
-
- return NULL;
-}
-
-void *
-slaveThread (void * arg)
-{
- struct timespec time;
-
- pthread_barrier_wait(&startBarrier);
-
- do
- {
- assert(pthread_mutex_lock(&control.mx) == 0);
- if (pthread_cond_timedwait(&control.cv,
- &control.mx,
- millisecondsFromNow(&time, control.value)) == ETIMEDOUT)
- {
- timeoutCount++;
- }
- else
- {
- signalsTakenCount++;
- }
- assert(pthread_mutex_unlock(&control.mx) == 0);
-
- pthread_barrier_wait(&holdBarrier);
- pthread_barrier_wait(&readyBarrier);
- }
- while (!allExit);
-
- return NULL;
-}
-
-int
-main ()
-{
- unsigned int i;
-
- assert(pthread_barrier_init(&startBarrier, NULL, 3) == 0);
- assert(pthread_barrier_init(&readyBarrier, NULL, 3) == 0);
- assert(pthread_barrier_init(&holdBarrier, NULL, 3) == 0);
-
- assert(pthread_create(&master, NULL, masterThread, (void *) timeout) == 0);
- assert(pthread_create(&slave, NULL, slaveThread, NULL) == 0);
-
- allExit = FALSE;
-
- pthread_barrier_wait(&startBarrier);
-
- for (i = 1; !allExit; i++)
- {
- pthread_barrier_wait(&holdBarrier);
- if (i >= ITERATIONS)
- {
- allExit = TRUE;
- }
- pthread_barrier_wait(&readyBarrier);
- }
-
- assert(pthread_join(slave, NULL) == 0);
- assert(pthread_join(master, NULL) == 0);
-
- printf("Signals sent = %d\nWait timeouts = %d\nSignals taken = %d\nBias = %d\nTimeout = %d\n",
- signalsSent,
- timeoutCount,
- signalsTakenCount,
- (int) bias,
- timeout);
-
- /* Cleanup */
- assert(pthread_barrier_destroy(&holdBarrier) == 0);
- assert(pthread_barrier_destroy(&readyBarrier) == 0);
- assert(pthread_barrier_destroy(&startBarrier) == 0);
- assert(pthread_cond_destroy(&control.cv) == 0);
- assert(pthread_mutex_destroy(&control.mx) == 0);
-
- /* Success. */
- return 0;
-}
+/*
+ * stress1.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:
+ * - Stress test condition variables, mutexes, semaphores.
+ *
+ * Test Method (Validation or Falsification):
+ * - Validation
+ *
+ * Requirements Tested:
+ * - Correct accounting of semaphore and condition variable waiters.
+ *
+ * Features Tested:
+ * -
+ *
+ * Cases Tested:
+ * -
+ *
+ * Description:
+ * Attempting to expose race conditions in cond vars, semaphores etc.
+ * - Master attempts to signal slave close to when timeout is due.
+ * - Master and slave do battle continuously until main tells them to stop.
+ * - Afterwards, the CV must be successfully destroyed (will return an
+ * error if there are waiters (including any internal semaphore waiters,
+ * which, if there are, cannot be real waiters).
+ *
+ * Environment:
+ * -
+ *
+ * Input:
+ * - None.
+ *
+ * Output:
+ * - File name, Line number, and failed expression on failure.
+ * - No output on success.
+ *
+ * Assumptions:
+ * -
+ *
+ * Pass Criteria:
+ * - CV is successfully destroyed.
+ *
+ * Fail Criteria:
+ * - CV destroy fails.
+ */
+
+#include "test.h"
+#include <string.h>
+#include <sys/timeb.h>
+
+
+const unsigned int ITERATIONS = 1000;
+
+static pthread_t master, slave;
+typedef struct {
+ int value;
+ pthread_cond_t cv;
+ pthread_mutex_t mx;
+} mysig_t;
+
+static int allExit;
+static mysig_t control = {0, PTHREAD_COND_INITIALIZER, PTHREAD_MUTEX_INITIALIZER};
+static pthread_barrier_t startBarrier, readyBarrier, holdBarrier;
+static int timeoutCount = 0;
+static int signalsTakenCount = 0;
+static int signalsSent = 0;
+static int bias = 0;
+static int timeout = 10; // Must be > 0
+
+enum {
+ CTL_STOP = -1
+};
+
+/*
+ * Returns abstime 'milliseconds' from 'now'.
+ *
+ * Works for: -INT_MAX <= millisecs <= INT_MAX
+ */
+struct timespec *
+millisecondsFromNow (struct timespec * time, int millisecs)
+{
+ PTW32_STRUCT_TIMEB currSysTime;
+ int64_t nanosecs, secs;
+ const int64_t NANOSEC_PER_MILLISEC = 1000000;
+ const int64_t NANOSEC_PER_SEC = 1000000000;
+
+ /* get current system time and add millisecs */
+ PTW32_FTIME(&currSysTime);
+
+ secs = (int64_t)(currSysTime.time) + (millisecs / 1000);
+ nanosecs = ((int64_t) (millisecs%1000 + currSysTime.millitm)) * NANOSEC_PER_MILLISEC;
+ if (nanosecs >= NANOSEC_PER_SEC)
+ {
+ secs++;
+ nanosecs -= NANOSEC_PER_SEC;
+ }
+ else if (nanosecs < 0)
+ {
+ secs--;
+ nanosecs += NANOSEC_PER_SEC;
+ }
+
+ time->tv_nsec = (long)nanosecs;
+ time->tv_sec = (long)secs;
+
+ return time;
+}
+
+void *
+masterThread (void * arg)
+{
+ int dither = (int)(size_t)arg;
+
+ timeout = (int)(size_t)arg;
+
+ pthread_barrier_wait(&startBarrier);
+
+ do
+ {
+ int sleepTime;
+
+ assert(pthread_mutex_lock(&control.mx) == 0);
+ control.value = timeout;
+ assert(pthread_mutex_unlock(&control.mx) == 0);
+
+ /*
+ * We are attempting to send the signal close to when the slave
+ * is due to timeout. We feel around by adding some [non-random] dither.
+ *
+ * dither is in the range 2*timeout peak-to-peak
+ * sleep time is the average of timeout plus dither.
+ * e.g.
+ * if timeout = 10 then dither = 20 and
+ * sleep millisecs is: 5 <= ms <= 15
+ *
+ * The bias value attempts to apply some negative feedback to keep
+ * the ratio of timeouts to signals taken close to 1:1.
+ * bias changes more slowly than dither so as to average more.
+ *
+ * Finally, if abs(bias) exceeds timeout then timeout is incremented.
+ */
+ if (signalsSent % timeout == 0)
+ {
+ if (timeoutCount > signalsTakenCount)
+ {
+ bias++;
+ }
+ else if (timeoutCount < signalsTakenCount)
+ {
+ bias--;
+ }
+ if (bias < -timeout || bias > timeout)
+ {
+ timeout++;
+ }
+ }
+ dither = (dither + 1 ) % (timeout * 2);
+ sleepTime = (timeout - bias + dither) / 2;
+ Sleep(sleepTime);
+ assert(pthread_cond_signal(&control.cv) == 0);
+ signalsSent++;
+
+ pthread_barrier_wait(&holdBarrier);
+ pthread_barrier_wait(&readyBarrier);
+ }
+ while (!allExit);
+
+ return NULL;
+}
+
+void *
+slaveThread (void * arg)
+{
+ struct timespec time;
+
+ pthread_barrier_wait(&startBarrier);
+
+ do
+ {
+ assert(pthread_mutex_lock(&control.mx) == 0);
+ if (pthread_cond_timedwait(&control.cv,
+ &control.mx,
+ millisecondsFromNow(&time, control.value)) == ETIMEDOUT)
+ {
+ timeoutCount++;
+ }
+ else
+ {
+ signalsTakenCount++;
+ }
+ assert(pthread_mutex_unlock(&control.mx) == 0);
+
+ pthread_barrier_wait(&holdBarrier);
+ pthread_barrier_wait(&readyBarrier);
+ }
+ while (!allExit);
+
+ return NULL;
+}
+
+int
+main ()
+{
+ unsigned int i;
+
+ assert(pthread_barrier_init(&startBarrier, NULL, 3) == 0);
+ assert(pthread_barrier_init(&readyBarrier, NULL, 3) == 0);
+ assert(pthread_barrier_init(&holdBarrier, NULL, 3) == 0);
+
+ assert(pthread_create(&master, NULL, masterThread, (void *)(size_t)timeout) == 0);
+ assert(pthread_create(&slave, NULL, slaveThread, NULL) == 0);
+
+ allExit = FALSE;
+
+ pthread_barrier_wait(&startBarrier);
+
+ for (i = 1; !allExit; i++)
+ {
+ pthread_barrier_wait(&holdBarrier);
+ if (i >= ITERATIONS)
+ {
+ allExit = TRUE;
+ }
+ pthread_barrier_wait(&readyBarrier);
+ }
+
+ assert(pthread_join(slave, NULL) == 0);
+ assert(pthread_join(master, NULL) == 0);
+
+ printf("Signals sent = %d\nWait timeouts = %d\nSignals taken = %d\nBias = %d\nTimeout = %d\n",
+ signalsSent,
+ timeoutCount,
+ signalsTakenCount,
+ (int) bias,
+ timeout);
+
+ /* Cleanup */
+ assert(pthread_barrier_destroy(&holdBarrier) == 0);
+ assert(pthread_barrier_destroy(&readyBarrier) == 0);
+ assert(pthread_barrier_destroy(&startBarrier) == 0);
+ assert(pthread_cond_destroy(&control.cv) == 0);
+ assert(pthread_mutex_destroy(&control.mx) == 0);
+
+ /* Success. */
+ return 0;
+}
diff --git a/pthreads/tests/test.h b/pthreads/tests/test.h
index dad485590..042e87b68 100644
--- a/pthreads/tests/test.h
+++ b/pthreads/tests/test.h
@@ -1,140 +1,182 @@
-/*
- * test.h
- *
- * Useful definitions and declarations for tests.
- *
- *
- * --------------------------------------------------------------------------
- *
- * 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
- *
- */
-
-#ifndef _PTHREAD_TEST_H_
-#define _PTHREAD_TEST_H_
-
-#include "pthread.h"
-#include "sched.h"
-#include "semaphore.h"
-
-#include <windows.h>
-#include <stdio.h>
-
-#define PTW32_THREAD_NULL_ID {NULL,0}
-
-#if defined(__MINGW32__)
-#include <stdint.h>
-#elif defined(__BORLANDC__)
-#define int64_t ULONGLONG
-#else
-#define int64_t _int64
-#endif
-
-
-const char * error_string[] = {
- "ZERO_or_EOK",
- "EPERM",
- "ENOFILE_or_ENOENT",
- "ESRCH",
- "EINTR",
- "EIO",
- "ENXIO",
- "E2BIG",
- "ENOEXEC",
- "EBADF",
- "ECHILD",
- "EAGAIN",
- "ENOMEM",
- "EACCES",
- "EFAULT",
- "UNKNOWN_15",
- "EBUSY",
- "EEXIST",
- "EXDEV",
- "ENODEV",
- "ENOTDIR",
- "EISDIR",
- "EINVAL",
- "ENFILE",
- "EMFILE",
- "ENOTTY",
- "UNKNOWN_26",
- "EFBIG",
- "ENOSPC",
- "ESPIPE",
- "EROFS",
- "EMLINK",
- "EPIPE",
- "EDOM",
- "ERANGE",
- "UNKNOWN_35",
- "EDEADLOCK_or_EDEADLK",
- "UNKNOWN_37",
- "ENAMETOOLONG",
- "ENOLCK",
- "ENOSYS",
- "ENOTEMPTY",
- "EILSEQ"
-};
-
-/*
- * The Mingw32 assert macro calls the CRTDLL _assert function
- * which pops up a dialog. We want to run in batch mode so
- * we define our own assert macro.
- */
-#ifdef assert
-# undef assert
-#endif
-
-#ifndef ASSERT_TRACE
-# define ASSERT_TRACE 0
-#else
-# undef ASSERT_TRACE
-# define ASSERT_TRACE 1
-#endif
-
-# define assert(e) \
- ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \
- "Assertion succeeded: (%s), file %s, line %d\n", \
- #e, __FILE__, (int) __LINE__), \
- fflush(stderr) : \
- 0) : \
- (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \
- #e, __FILE__, (int) __LINE__), exit(1), 0))
-
-int assertE;
-# define assert_e(e, o, r) \
- (((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stderr, \
- "Assertion succeeded: (%s), file %s, line %d\n", \
- #e, __FILE__, (int) __LINE__), \
- fflush(stderr) : \
- 0) : \
- (fprintf(stderr, "Assertion failed: (%s %s %s), file %s, line %d, error %s\n", \
- #e,#o,#r, __FILE__, (int) __LINE__, error_string[assertE]), exit(1), 0))
-
-#endif
+/*
+ * test.h
+ *
+ * Useful definitions and declarations for tests.
+ *
+ *
+ * --------------------------------------------------------------------------
+ *
+ * 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
+ *
+ */
+
+#ifndef _PTHREAD_TEST_H_
+#define _PTHREAD_TEST_H_
+
+#include "pthread.h"
+#include "sched.h"
+#include "semaphore.h"
+
+#include <windows.h>
+#include <stdio.h>
+
+#define PTW32_THREAD_NULL_ID {NULL,0}
+
+/*
+ * Some non-thread POSIX API substitutes
+ */
+#define rand_r( _seed ) \
+ ( _seed == _seed? rand() : rand() )
+
+#if defined(__MINGW32__)
+#include <stdint.h>
+#elif defined(__BORLANDC__)
+#define int64_t ULONGLONG
+#else
+#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 )
+# define PTW32_FTIME(x) _ftime64(x)
+# define PTW32_STRUCT_TIMEB struct __timeb64
+#else
+# define PTW32_FTIME(x) _ftime(x)
+# define PTW32_STRUCT_TIMEB struct _timeb
+#endif
+
+
+const char * error_string[] = {
+ "ZERO_or_EOK",
+ "EPERM",
+ "ENOFILE_or_ENOENT",
+ "ESRCH",
+ "EINTR",
+ "EIO",
+ "ENXIO",
+ "E2BIG",
+ "ENOEXEC",
+ "EBADF",
+ "ECHILD",
+ "EAGAIN",
+ "ENOMEM",
+ "EACCES",
+ "EFAULT",
+ "UNKNOWN_15",
+ "EBUSY",
+ "EEXIST",
+ "EXDEV",
+ "ENODEV",
+ "ENOTDIR",
+ "EISDIR",
+ "EINVAL",
+ "ENFILE",
+ "EMFILE",
+ "ENOTTY",
+ "UNKNOWN_26",
+ "EFBIG",
+ "ENOSPC",
+ "ESPIPE",
+ "EROFS",
+ "EMLINK",
+ "EPIPE",
+ "EDOM",
+ "ERANGE",
+ "UNKNOWN_35",
+ "EDEADLOCK_or_EDEADLK",
+ "UNKNOWN_37",
+ "ENAMETOOLONG",
+ "ENOLCK",
+ "ENOSYS",
+ "ENOTEMPTY",
+ "EILSEQ",
+ "EOWNERDEAD",
+ "ENOTRECOVERABLE"
+};
+
+/*
+ * The Mingw32 assert macro calls the CRTDLL _assert function
+ * which pops up a dialog. We want to run in batch mode so
+ * we define our own assert macro.
+ */
+#ifdef assert
+# undef assert
+#endif
+
+#ifndef ASSERT_TRACE
+# define ASSERT_TRACE 0
+#else
+# undef ASSERT_TRACE
+# define ASSERT_TRACE 1
+#endif
+
+# define assert(e) \
+ ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \
+ "Assertion succeeded: (%s), file %s, line %d\n", \
+ #e, __FILE__, (int) __LINE__), \
+ fflush(stderr) : \
+ 0) : \
+ (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \
+ #e, __FILE__, (int) __LINE__), exit(1), 0))
+
+int assertE;
+# define assert_e(e, o, r) \
+ (((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stderr, \
+ "Assertion succeeded: (%s), file %s, line %d\n", \
+ #e, __FILE__, (int) __LINE__), \
+ fflush(stderr) : \
+ 0) : \
+ (fprintf(stderr, "Assertion failed: (%s %s %s), file %s, line %d, error %s\n", \
+ #e,#o,#r, __FILE__, (int) __LINE__, error_string[assertE]), exit(1), 0))
+
+#endif
+
+# define BEGIN_MUTEX_STALLED_ROBUST(mxAttr) \
+ for(;;) \
+ { \
+ static int _i=0; \
+ static int _robust; \
+ pthread_mutexattr_getrobust(&(mxAttr), &_robust);
+
+# define END_MUTEX_STALLED_ROBUST(mxAttr) \
+ printf("Pass %s\n", _robust==PTHREAD_MUTEX_ROBUST?"Robust":"Non-robust"); \
+ if (++_i > 1) \
+ break; \
+ else \
+ { \
+ pthread_mutexattr_t *pma, *pmaEnd; \
+ for(pma = &(mxAttr), pmaEnd = pma + sizeof(mxAttr)/sizeof(pthread_mutexattr_t); \
+ pma < pmaEnd; \
+ pthread_mutexattr_setrobust(pma++, PTHREAD_MUTEX_ROBUST)); \
+ } \
+ }
+
+# define IS_ROBUST (_robust==PTHREAD_MUTEX_ROBUST)
diff --git a/pthreads/tests/tsd1.c b/pthreads/tests/tsd1.c
index c28e4c53e..84d78886c 100644
--- a/pthreads/tests/tsd1.c
+++ b/pthreads/tests/tsd1.c
@@ -179,9 +179,7 @@ main()
*/
for (i = 1; i < NUM_THREADS; i++)
{
- int result = 0;
-
- assert(pthread_join(thread[i], (void **) &result) == 0);
+ assert(pthread_join(thread[i], NULL) == 0);
}
assert(pthread_key_delete(key) == 0);
diff --git a/pthreads/tests/tsd2.c b/pthreads/tests/tsd2.c
index d1f50cde3..16e69948c 100644
--- a/pthreads/tests/tsd2.c
+++ b/pthreads/tests/tsd2.c
@@ -183,9 +183,7 @@ main()
*/
for (i = 1; i < NUM_THREADS; i++)
{
- int result = 0;
-
- assert(pthread_join(thread[i], (void **) &result) == 0);
+ assert(pthread_join(thread[i], NULL) == 0);
}
assert(pthread_key_delete(key) == 0);
diff --git a/pthreads/tests/valid1.c b/pthreads/tests/valid1.c
index 4d5cab592..a3913fd04 100644
--- a/pthreads/tests/valid1.c
+++ b/pthreads/tests/valid1.c
@@ -94,7 +94,7 @@ main()
washere = 0;
assert(pthread_create(&t, NULL, func, NULL) == 0);
assert(pthread_join(t, &result) == 0);
- assert(result == 0);
+ assert((int)(size_t)result == 0);
assert(washere == 1);
sched_yield();
assert(pthread_kill(t, 0) == ESRCH);