summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ANNOUNCE2
-rw-r--r--ChangeLog16
-rw-r--r--GNUmakefile1054
-rw-r--r--README.Borland102
-rw-r--r--config.h9
-rw-r--r--ptw32_InterlockedCompareExchange.c4
-rw-r--r--tests/Bmakefile1
-rw-r--r--tests/GNUmakefile664
-rw-r--r--tests/Wmakefile10
-rw-r--r--version.rc39
10 files changed, 979 insertions, 922 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index a10af55..ddd35f1 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,4 +1,4 @@
- PTHREADS-WIN32 SNAPSHOT 2005-01-02
+ PTHREADS-WIN32 SNAPSHOT 2005-01-03
----------------------------------
Web Site: http://sources.redhat.com/pthreads-win32/
FTP Site: ftp://sources.redhat.com/pub/pthreads-win32
diff --git a/ChangeLog b/ChangeLog
index 098be4f..7e4595c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,15 @@
2005-01-01 Konstantin Voronkov <beowinkle at yahoo.com>
- * pthread_mutex_lock.c (pthread_mutex_lock): The new atomic exchange
- mutex algorithm is known to allow a thread to steal the lock off
- FIFO waiting threads. The next waiting FIFO thread gets a spurious
- wake-up and must attempt to re-acquire the lock. The woken thread
- was setting itself as the the mutex's owner before the re-acquisition.
-
+ * pthread_mutex_lock.c (pthread_mutex_lock): The new atomic exchange
+ mutex algorithm is known to allow a thread to steal the lock off
+ FIFO waiting threads. The next waiting FIFO thread gets a spurious
+ wake-up and must attempt to re-acquire the lock. The woken thread
+ was setting itself as the the mutex's owner before the re-acquisition.
+
2004-11-22 Ross Johnson <rpj at callisto.canberra.edu.au>
- * pthread_cond_wait.c (ptw32_cond_wait_cleanup): Undo change
- from 2004-11-02.
+ * pthread_cond_wait.c (ptw32_cond_wait_cleanup): Undo change
+ from 2004-11-02.
* Makefile (DLL_VER): Added for DLL naming suffix - see README.
* GNUmakefile (DLL_VER): Likewise.
* Wmakefile (DLL_VER): Likewise.
diff --git a/GNUmakefile b/GNUmakefile
index 5dc76bc..c5be525 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,527 +1,527 @@
-#
-# --------------------------------------------------------------------------
-#
-# 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 = 1
-
-DEVROOT = C:\PTHREADS
-
-DLLDEST = $(DEVROOT)\DLL
-LIBDEST = $(DEVROOT)\DLL
-
-# If Running MsysDTK
-RM = rm -f
-MV = mv -f
-CP = cp -f
-RC = windres
-
-# If not.
-#RM = erase
-#MV = rename
-#CP = copy
-
-AR = ar
-
-#OPT = -g -O0
-#OPT = -O3
-OPT = -O3 -finline-functions
-XOPT =
-
-RCFLAGS = --include-dir=.
-LFLAGS = -lwsock32
-
-# ----------------------------------------------------------------------
-# The library can be built with some alternative behaviour to
-# facilitate development of applications on Win32 that will be ported
-# to other POSIX systems. Nothing definable here will make the library
-# non-compliant, but applications that make assumptions that POSIX
-# does not garrantee may fail or misbehave under some settings.
-#
-# PTW32_THREAD_ID_REUSE_INCREMENT
-# Purpose:
-# POSIX says that applications should assume that thread IDs can be
-# recycled. However, Solaris and some other systems use a [very large]
-# sequence number as the thread ID, which provides virtual uniqueness.
-#
-# Usage:
-# Set to any value in the range: 0 <= value <= 2^wordsize
-#
-# Examples:
-# Set to 0 to emulate non recycle-unique behaviour like Linux or *BSD.
-# Set to 1 for recycle-unique thread IDs like Solaris (this is the default).
-# Set to some other +ve value to emulate smaller word size types (i.e. will
-# wrap sooner). This might be useful to emulate some embedded systems.
-#
-#PTW32_FLAGS = "-DPTW32_THREAD_ID_REUSE_INCREMENT=0"
-#
-# ----------------------------------------------------------------------
-
-GC_CFLAGS = $(PTW32_FLAGS) -D__CLEANUP_C
-GCE_CFLAGS = $(PTW32_FLAGS) -D__CLEANUP_CXX -mthreads
-
-## Mingw32
-MAKE = make
-CFLAGS = $(OPT) $(XOPT) -I. -DHAVE_CONFIG_H -Wall
-
-DLL_INLINED_OBJS = \
- pthread.o \
- version.o
-
-# Agregate modules for inlinability
-DLL_OBJS = \
- attr.o \
- barrier.o \
- cancel.o \
- cleanup.o \
- condvar.o \
- create.o \
- dll.o \
- errno.o \
- exit.o \
- fork.o \
- global.o \
- misc.o \
- mutex.o \
- nonportable.o \
- private.o \
- rwlock.o \
- sched.o \
- semaphore.o \
- signal.o \
- spin.o \
- sync.o \
- tsd.o \
- version.o
-
-# Separate modules for minimum size statically linked images
-SMALL_STATIC_OBJS = \
- pthread_attr_init.o \
- pthread_attr_destroy.o \
- pthread_attr_getdetachstate.o \
- pthread_attr_setdetachstate.o \
- pthread_attr_getstackaddr.o \
- pthread_attr_setstackaddr.o \
- pthread_attr_getstacksize.o \
- pthread_attr_setstacksize.o \
- pthread_attr_getscope.o \
- pthread_attr_setscope.o \
- pthread_attr_setschedpolicy.o \
- pthread_attr_getschedpolicy.o \
- pthread_attr_setschedparam.o \
- pthread_attr_getschedparam.o \
- pthread_attr_setinheritsched.o \
- pthread_attr_getinheritsched.o \
- pthread_barrier_init.o \
- pthread_barrier_destroy.o \
- pthread_barrier_wait.o \
- pthread_barrierattr_init.o \
- pthread_barrierattr_destroy.o \
- pthread_barrierattr_setpshared.o \
- pthread_barrierattr_getpshared.o \
- pthread_setcancelstate.o \
- pthread_setcanceltype.o \
- pthread_testcancel.o \
- pthread_cancel.o \
- cleanup.o \
- pthread_condattr_destroy.o \
- pthread_condattr_getpshared.o \
- pthread_condattr_init.o \
- pthread_condattr_setpshared.o \
- pthread_cond_destroy.o \
- pthread_cond_init.o \
- pthread_cond_signal.o \
- pthread_cond_wait.o \
- create.o \
- dll.o \
- errno.o \
- pthread_exit.o \
- fork.o \
- global.o \
- pthread_mutex_init.o \
- pthread_mutex_destroy.o \
- pthread_mutexattr_init.o \
- pthread_mutexattr_destroy.o \
- pthread_mutexattr_getpshared.o \
- pthread_mutexattr_setpshared.o \
- pthread_mutexattr_settype.o \
- pthread_mutexattr_gettype.o \
- pthread_mutex_lock.o \
- pthread_mutex_timedlock.o \
- pthread_mutex_unlock.o \
- pthread_mutex_trylock.o \
- pthread_mutexattr_setkind_np.o \
- pthread_mutexattr_getkind_np.o \
- pthread_getw32threadhandle_np.o \
- pthread_delay_np.o \
- pthread_num_processors_np.o \
- pthread_win32_attach_detach_np.o \
- pthread_equal.o \
- pthread_getconcurrency.o \
- pthread_once.o \
- pthread_self.o \
- pthread_setconcurrency.o \
- pthread_rwlock_init.o \
- pthread_rwlock_destroy.o \
- pthread_rwlockattr_init.o \
- pthread_rwlockattr_destroy.o \
- pthread_rwlockattr_getpshared.o \
- pthread_rwlockattr_setpshared.o \
- pthread_rwlock_rdlock.o \
- pthread_rwlock_wrlock.o \
- pthread_rwlock_unlock.o \
- pthread_rwlock_tryrdlock.o \
- pthread_rwlock_trywrlock.o \
- pthread_setschedparam.o \
- pthread_getschedparam.o \
- pthread_timechange_handler_np.o \
- ptw32_is_attr.o \
- ptw32_cond_check_need_init.o \
- ptw32_mutex_check_need_init.o \
- ptw32_processInitialize.o \
- ptw32_processTerminate.o \
- ptw32_threadStart.o \
- ptw32_threadDestroy.o \
- ptw32_tkAssocCreate.o \
- ptw32_tkAssocDestroy.o \
- ptw32_callUserDestroyRoutines.o \
- ptw32_timespec.o \
- ptw32_throw.o \
- ptw32_InterlockedCompareExchange.o \
- ptw32_getprocessors.o \
- ptw32_calloc.o \
- ptw32_new.o \
- ptw32_reuse.o \
- ptw32_semwait.o \
- ptw32_rwlock_check_need_init.o \
- sched_get_priority_max.o \
- sched_get_priority_min.o \
- sched_setscheduler.o \
- sched_getscheduler.o \
- sched_yield.o \
- sem_init.o \
- sem_destroy.o \
- sem_trywait.o \
- sem_timedwait.o \
- sem_wait.o \
- sem_post.o \
- sem_post_multiple.o \
- sem_getvalue.o \
- sem_open.o \
- sem_close.o \
- sem_unlink.o \
- ptw32_increase_semaphore.o \
- ptw32_decrease_semaphore.o \
- signal.o \
- pthread_kill.o \
- ptw32_spinlock_check_need_init.o \
- pthread_spin_init.o \
- pthread_spin_destroy.o \
- pthread_spin_lock.o \
- pthread_spin_unlock.o \
- pthread_spin_trylock.o \
- pthread_detach.o \
- pthread_join.o \
- pthread_key_create.o \
- pthread_key_delete.o \
- pthread_setspecific.o \
- pthread_getspecific.o \
- w32_CancelableWait.o \
- version.o
-
-INCL = \
- config.h \
- implement.h \
- semaphore.h \
- pthread.h \
- need_errno.h
-
-ATTR_SRCS = \
- pthread_attr_init.c \
- pthread_attr_destroy.c \
- pthread_attr_getdetachstate.c \
- pthread_attr_setdetachstate.c \
- pthread_attr_getstackaddr.c \
- pthread_attr_setstackaddr.c \
- pthread_attr_getstacksize.c \
- pthread_attr_setstacksize.c \
- pthread_attr_getscope.c \
- pthread_attr_setscope.c
-
-BARRIER_SRCS = \
- pthread_barrier_init.c \
- pthread_barrier_destroy.c \
- pthread_barrier_wait.c \
- pthread_barrierattr_init.c \
- pthread_barrierattr_destroy.c \
- pthread_barrierattr_setpshared.c \
- pthread_barrierattr_getpshared.c
-
-CANCEL_SRCS = \
- pthread_setcancelstate.c \
- pthread_setcanceltype.c \
- pthread_testcancel.c \
- pthread_cancel.c
-
-CONDVAR_SRCS = \
- ptw32_cond_check_need_init.c \
- pthread_condattr_destroy.c \
- pthread_condattr_getpshared.c \
- pthread_condattr_init.c \
- pthread_condattr_setpshared.c \
- pthread_cond_destroy.c \
- pthread_cond_init.c \
- pthread_cond_signal.c \
- pthread_cond_wait.c
-
-EXIT_SRCS = \
- pthread_exit.c
-
-MISC_SRCS = \
- pthread_equal.c \
- pthread_getconcurrency.c \
- pthread_kill.c \
- pthread_once.c \
- pthread_self.c \
- pthread_setconcurrency.c \
- ptw32_calloc.c \
- ptw32_new.c \
- ptw32_reuse.c \
- w32_CancelableWait.c
-
-MUTEX_SRCS = \
- ptw32_mutex_check_need_init.c \
- pthread_mutex_init.c \
- pthread_mutex_destroy.c \
- pthread_mutexattr_init.c \
- pthread_mutexattr_destroy.c \
- pthread_mutexattr_getpshared.c \
- pthread_mutexattr_setpshared.c \
- pthread_mutexattr_settype.c \
- pthread_mutexattr_gettype.c \
- pthread_mutex_lock.c \
- pthread_mutex_timedlock.c \
- pthread_mutex_unlock.c \
- pthread_mutex_trylock.c
-
-NONPORTABLE_SRCS = \
- pthread_mutexattr_setkind_np.c \
- pthread_mutexattr_getkind_np.c \
- pthread_getw32threadhandle_np.c \
- pthread_delay_np.c \
- pthread_num_processors_np.c \
- pthread_win32_attach_detach_np.c \
- pthread_timechange_handler_np.c
-
-PRIVATE_SRCS = \
- ptw32_is_attr.c \
- ptw32_processInitialize.c \
- ptw32_processTerminate.c \
- ptw32_threadStart.c \
- ptw32_threadDestroy.c \
- ptw32_tkAssocCreate.c \
- ptw32_tkAssocDestroy.c \
- ptw32_callUserDestroyRoutines.c \
- ptw32_semwait.c \
- ptw32_timespec.c \
- ptw32_throw.c \
- ptw32_InterlockedCompareExchange.c \
- ptw32_getprocessors.c
-
-RWLOCK_SRCS = \
- ptw32_rwlock_check_need_init.c \
- ptw32_rwlock_cancelwrwait.c \
- pthread_rwlock_init.c \
- pthread_rwlock_destroy.c \
- pthread_rwlockattr_init.c \
- pthread_rwlockattr_destroy.c \
- pthread_rwlockattr_getpshared.c \
- pthread_rwlockattr_setpshared.c \
- pthread_rwlock_rdlock.c \
- pthread_rwlock_timedrdlock.c \
- pthread_rwlock_wrlock.c \
- pthread_rwlock_timedwrlock.c \
- pthread_rwlock_unlock.c \
- pthread_rwlock_tryrdlock.c \
- pthread_rwlock_trywrlock.c
-
-SCHED_SRCS = \
- pthread_attr_setschedpolicy.c \
- pthread_attr_getschedpolicy.c \
- pthread_attr_setschedparam.c \
- pthread_attr_getschedparam.c \
- pthread_attr_setinheritsched.c \
- pthread_attr_getinheritsched.c \
- pthread_setschedparam.c \
- pthread_getschedparam.c \
- sched_get_priority_max.c \
- sched_get_priority_min.c \
- sched_setscheduler.c \
- sched_getscheduler.c \
- sched_yield.c
-
-SEMAPHORE_SRCS = \
- sem_init.c \
- sem_destroy.c \
- sem_trywait.c \
- sem_timedwait.c \
- sem_wait.c \
- sem_post.c \
- sem_post_multiple.c \
- sem_getvalue.c \
- sem_open.c \
- sem_close.c \
- sem_unlink.c \
- ptw32_increase_semaphore.c \
- ptw32_decrease_semaphore.c
-
-SPIN_SRCS = \
- ptw32_spinlock_check_need_init.c \
- pthread_spin_init.c \
- pthread_spin_destroy.c \
- pthread_spin_lock.c \
- pthread_spin_unlock.c \
- pthread_spin_trylock.c
-
-SYNC_SRCS = \
- pthread_detach.c \
- pthread_join.c
-
-TSD_SRCS = \
- pthread_key_create.c \
- pthread_key_delete.c \
- pthread_setspecific.c \
- pthread_getspecific.c
-
-
-GCE_DLL = pthreadGCE$(DLL_VER).dll
-GCE_LIB = libpthreadGCE$(DLL_VER).a
-GCE_INLINED_STAMP = pthreadGCE$(DLL_VER).stamp
-
-GC_DLL = pthreadGC$(DLL_VER).dll
-GC_LIB = libpthreadGC$(DLL_VER).a
-GC_INLINED_STAMP = pthreadGC$(DLL_VER).stamp
-
-PTHREAD_DEF = pthread.def
-
-help:
- @ echo "Run one of the following command lines:"
- @ echo "make clean GCE (to build the GNU C dll with C++ exception handling)"
- @ echo "make clean GC (to build the GNU C dll with C cleanup code)"
- @ echo "make clean GCE-inlined (to build the GNU C inlined dll with C++ exception handling)"
- @ echo "make clean GC-inlined (to build the GNU C inlined dll with C cleanup code)"
-
-all:
- @ $(MAKE) clean GCE
- @ $(MAKE) clean GC
-
-GC:
- $(MAKE) CC=gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
-
-GCE:
- $(MAKE) CC=g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
-
-GC-inlined:
- $(MAKE) CC=gcc XOPT="-DPTW32_BUILD_INLINED" CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP)
-
-GCE-inlined:
- $(MAKE) CC=g++ XOPT="-DPTW32_BUILD_INLINED" CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
-
-tests:
- @ cd tests
- @ $(MAKE) auto
-
-%.pre: %.c
- $(CC) -E -o $@ $(CFLAGS) $^
-
-%.s: %.c
- $(CC) -c $(CFLAGS) -Wa,-ahl $^ > $@
-
-%.o: %.rc
- $(RC) $(RCFLAGS) -o $@ $<
-
-.SUFFIXES: .dll .rc .c .o
-
-.c.o:; $(CC) -c -o $@ $(CFLAGS) $(CLEANUP_FLAGS) $<
-
-
-$(GC_DLL): $(DLL_OBJS)
- $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS)
- dlltool -z pthread.def $(DLL_OBJS)
- dlltool -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
-
-$(GCE_DLL): $(DLL_OBJS)
- $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS)
- dlltool -z pthread.def $(DLL_OBJS)
- dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
-
-$(GC_INLINED_STAMP): $(DLL_INLINED_OBJS)
- $(CC) $(OPT) $(XOPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
- dlltool -z pthread.def $(DLL_INLINED_OBJS)
- dlltool -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
- echo touched > $(GC_INLINED_STAMP)
-
-$(GCE_INLINED_STAMP): $(DLL_INLINED_OBJS)
- $(CC) $(OPT) $(XOPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
- dlltool -z pthread.def $(DLL_INLINED_OBJS)
- dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
- echo touched > $(GCE_INLINED_STAMP)
-
-clean:
- -$(RM) *~
- -$(RM) *.i
- -$(RM) *.o
- -$(RM) *.obj
- -$(RM) *.exe
- -$(RM) $(PTHREAD_DEF)
-
-realclean: clean
- -$(RM) $(GC_LIB)
- -$(RM) $(GCE_LIB)
- -$(RM) $(GC_DLL)
- -$(RM) $(GCE_DLL)
- -$(RM) $(GC_INLINED_STAMP)
- -$(RM) $(GCE_INLINED_STAMP)
-
-attr.o: attr.c $(ATTR_SRCS) $(INCL)
-barrier.o: barrier.c $(BARRIER_SRCS) $(INCL)
-cancel.o: cancel.c $(CANCEL_SRCS) $(INCL)
-condvar.o: condvar.c $(CONDVAR_SRCS) $(INCL)
-exit.o: exit.c $(EXIT_SRCS) $(INCL)
-misc.o: misc.c $(MISC_SRCS) $(INCL)
-mutex.o: mutex.c $(MUTEX_SRCS) $(INCL)
-nonportable.o: nonportable.c $(NONPORTABLE_SRCS) $(INCL)
-private.o: private.c $(PRIVATE_SRCS) $(INCL)
-rwlock.o: rwlock.c $(RWLOCK_SRCS) $(INCL)
-sched.o: sched.c $(SCHED_SRCS) $(INCL)
-semaphore.o: semaphore.c $(SEMAPHORE_SRCS) $(INCL)
-spin.o: spin.c $(SPIN_SRCS) $(INCL)
-sync.o: sync.c $(SYNC_SRCS) $(INCL)
-tsd.o: tsd.c $(TSD_SRCS) $(INCL)
-version.o: version.rc $(INCL)
+#
+# --------------------------------------------------------------------------
+#
+# 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 = 1
+
+DEVROOT = C:\PTHREADS
+
+DLLDEST = $(DEVROOT)\DLL
+LIBDEST = $(DEVROOT)\DLL
+
+# If Running MsysDTK
+RM = rm -f
+MV = mv -f
+CP = cp -f
+RC = windres
+
+# If not.
+#RM = erase
+#MV = rename
+#CP = copy
+
+AR = ar
+
+#OPT = -g -O0
+#OPT = -O3
+OPT = -O3 -finline-functions
+XOPT =
+
+RCFLAGS = --include-dir=.
+LFLAGS = -lwsock32
+
+# ----------------------------------------------------------------------
+# The library can be built with some alternative behaviour to
+# facilitate development of applications on Win32 that will be ported
+# to other POSIX systems. Nothing definable here will make the library
+# non-compliant, but applications that make assumptions that POSIX
+# does not garrantee may fail or misbehave under some settings.
+#
+# PTW32_THREAD_ID_REUSE_INCREMENT
+# Purpose:
+# POSIX says that applications should assume that thread IDs can be
+# recycled. However, Solaris and some other systems use a [very large]
+# sequence number as the thread ID, which provides virtual uniqueness.
+#
+# Usage:
+# Set to any value in the range: 0 <= value <= 2^wordsize
+#
+# Examples:
+# Set to 0 to emulate non recycle-unique behaviour like Linux or *BSD.
+# Set to 1 for recycle-unique thread IDs like Solaris (this is the default).
+# Set to some other +ve value to emulate smaller word size types (i.e. will
+# wrap sooner). This might be useful to emulate some embedded systems.
+#
+#PTW32_FLAGS = "-DPTW32_THREAD_ID_REUSE_INCREMENT=0"
+#
+# ----------------------------------------------------------------------
+
+GC_CFLAGS = $(PTW32_FLAGS) -D__CLEANUP_C
+GCE_CFLAGS = $(PTW32_FLAGS) -D__CLEANUP_CXX -mthreads
+
+## Mingw32
+MAKE = make
+CFLAGS = $(OPT) $(XOPT) -I. -DHAVE_CONFIG_H -Wall
+
+DLL_INLINED_OBJS = \
+ pthread.o \
+ version.o
+
+# Agregate modules for inlinability
+DLL_OBJS = \
+ attr.o \
+ barrier.o \
+ cancel.o \
+ cleanup.o \
+ condvar.o \
+ create.o \
+ dll.o \
+ errno.o \
+ exit.o \
+ fork.o \
+ global.o \
+ misc.o \
+ mutex.o \
+ nonportable.o \
+ private.o \
+ rwlock.o \
+ sched.o \
+ semaphore.o \
+ signal.o \
+ spin.o \
+ sync.o \
+ tsd.o \
+ version.o
+
+# Separate modules for minimum size statically linked images
+SMALL_STATIC_OBJS = \
+ pthread_attr_init.o \
+ pthread_attr_destroy.o \
+ pthread_attr_getdetachstate.o \
+ pthread_attr_setdetachstate.o \
+ pthread_attr_getstackaddr.o \
+ pthread_attr_setstackaddr.o \
+ pthread_attr_getstacksize.o \
+ pthread_attr_setstacksize.o \
+ pthread_attr_getscope.o \
+ pthread_attr_setscope.o \
+ pthread_attr_setschedpolicy.o \
+ pthread_attr_getschedpolicy.o \
+ pthread_attr_setschedparam.o \
+ pthread_attr_getschedparam.o \
+ pthread_attr_setinheritsched.o \
+ pthread_attr_getinheritsched.o \
+ pthread_barrier_init.o \
+ pthread_barrier_destroy.o \
+ pthread_barrier_wait.o \
+ pthread_barrierattr_init.o \
+ pthread_barrierattr_destroy.o \
+ pthread_barrierattr_setpshared.o \
+ pthread_barrierattr_getpshared.o \
+ pthread_setcancelstate.o \
+ pthread_setcanceltype.o \
+ pthread_testcancel.o \
+ pthread_cancel.o \
+ cleanup.o \
+ pthread_condattr_destroy.o \
+ pthread_condattr_getpshared.o \
+ pthread_condattr_init.o \
+ pthread_condattr_setpshared.o \
+ pthread_cond_destroy.o \
+ pthread_cond_init.o \
+ pthread_cond_signal.o \
+ pthread_cond_wait.o \
+ create.o \
+ dll.o \
+ errno.o \
+ pthread_exit.o \
+ fork.o \
+ global.o \
+ pthread_mutex_init.o \
+ pthread_mutex_destroy.o \
+ pthread_mutexattr_init.o \
+ pthread_mutexattr_destroy.o \
+ pthread_mutexattr_getpshared.o \
+ pthread_mutexattr_setpshared.o \
+ pthread_mutexattr_settype.o \
+ pthread_mutexattr_gettype.o \
+ pthread_mutex_lock.o \
+ pthread_mutex_timedlock.o \
+ pthread_mutex_unlock.o \
+ pthread_mutex_trylock.o \
+ pthread_mutexattr_setkind_np.o \
+ pthread_mutexattr_getkind_np.o \
+ pthread_getw32threadhandle_np.o \
+ pthread_delay_np.o \
+ pthread_num_processors_np.o \
+ pthread_win32_attach_detach_np.o \
+ pthread_equal.o \
+ pthread_getconcurrency.o \
+ pthread_once.o \
+ pthread_self.o \
+ pthread_setconcurrency.o \
+ pthread_rwlock_init.o \
+ pthread_rwlock_destroy.o \
+ pthread_rwlockattr_init.o \
+ pthread_rwlockattr_destroy.o \
+ pthread_rwlockattr_getpshared.o \
+ pthread_rwlockattr_setpshared.o \
+ pthread_rwlock_rdlock.o \
+ pthread_rwlock_wrlock.o \
+ pthread_rwlock_unlock.o \
+ pthread_rwlock_tryrdlock.o \
+ pthread_rwlock_trywrlock.o \
+ pthread_setschedparam.o \
+ pthread_getschedparam.o \
+ pthread_timechange_handler_np.o \
+ ptw32_is_attr.o \
+ ptw32_cond_check_need_init.o \
+ ptw32_mutex_check_need_init.o \
+ ptw32_processInitialize.o \
+ ptw32_processTerminate.o \
+ ptw32_threadStart.o \
+ ptw32_threadDestroy.o \
+ ptw32_tkAssocCreate.o \
+ ptw32_tkAssocDestroy.o \
+ ptw32_callUserDestroyRoutines.o \
+ ptw32_timespec.o \
+ ptw32_throw.o \
+ ptw32_InterlockedCompareExchange.o \
+ ptw32_getprocessors.o \
+ ptw32_calloc.o \
+ ptw32_new.o \
+ ptw32_reuse.o \
+ ptw32_semwait.o \
+ ptw32_rwlock_check_need_init.o \
+ sched_get_priority_max.o \
+ sched_get_priority_min.o \
+ sched_setscheduler.o \
+ sched_getscheduler.o \
+ sched_yield.o \
+ sem_init.o \
+ sem_destroy.o \
+ sem_trywait.o \
+ sem_timedwait.o \
+ sem_wait.o \
+ sem_post.o \
+ sem_post_multiple.o \
+ sem_getvalue.o \
+ sem_open.o \
+ sem_close.o \
+ sem_unlink.o \
+ ptw32_increase_semaphore.o \
+ ptw32_decrease_semaphore.o \
+ signal.o \
+ pthread_kill.o \
+ ptw32_spinlock_check_need_init.o \
+ pthread_spin_init.o \
+ pthread_spin_destroy.o \
+ pthread_spin_lock.o \
+ pthread_spin_unlock.o \
+ pthread_spin_trylock.o \
+ pthread_detach.o \
+ pthread_join.o \
+ pthread_key_create.o \
+ pthread_key_delete.o \
+ pthread_setspecific.o \
+ pthread_getspecific.o \
+ w32_CancelableWait.o \
+ version.o
+
+INCL = \
+ config.h \
+ implement.h \
+ semaphore.h \
+ pthread.h \
+ need_errno.h
+
+ATTR_SRCS = \
+ pthread_attr_init.c \
+ pthread_attr_destroy.c \
+ pthread_attr_getdetachstate.c \
+ pthread_attr_setdetachstate.c \
+ pthread_attr_getstackaddr.c \
+ pthread_attr_setstackaddr.c \
+ pthread_attr_getstacksize.c \
+ pthread_attr_setstacksize.c \
+ pthread_attr_getscope.c \
+ pthread_attr_setscope.c
+
+BARRIER_SRCS = \
+ pthread_barrier_init.c \
+ pthread_barrier_destroy.c \
+ pthread_barrier_wait.c \
+ pthread_barrierattr_init.c \
+ pthread_barrierattr_destroy.c \
+ pthread_barrierattr_setpshared.c \
+ pthread_barrierattr_getpshared.c
+
+CANCEL_SRCS = \
+ pthread_setcancelstate.c \
+ pthread_setcanceltype.c \
+ pthread_testcancel.c \
+ pthread_cancel.c
+
+CONDVAR_SRCS = \
+ ptw32_cond_check_need_init.c \
+ pthread_condattr_destroy.c \
+ pthread_condattr_getpshared.c \
+ pthread_condattr_init.c \
+ pthread_condattr_setpshared.c \
+ pthread_cond_destroy.c \
+ pthread_cond_init.c \
+ pthread_cond_signal.c \
+ pthread_cond_wait.c
+
+EXIT_SRCS = \
+ pthread_exit.c
+
+MISC_SRCS = \
+ pthread_equal.c \
+ pthread_getconcurrency.c \
+ pthread_kill.c \
+ pthread_once.c \
+ pthread_self.c \
+ pthread_setconcurrency.c \
+ ptw32_calloc.c \
+ ptw32_new.c \
+ ptw32_reuse.c \
+ w32_CancelableWait.c
+
+MUTEX_SRCS = \
+ ptw32_mutex_check_need_init.c \
+ pthread_mutex_init.c \
+ pthread_mutex_destroy.c \
+ pthread_mutexattr_init.c \
+ pthread_mutexattr_destroy.c \
+ pthread_mutexattr_getpshared.c \
+ pthread_mutexattr_setpshared.c \
+ pthread_mutexattr_settype.c \
+ pthread_mutexattr_gettype.c \
+ pthread_mutex_lock.c \
+ pthread_mutex_timedlock.c \
+ pthread_mutex_unlock.c \
+ pthread_mutex_trylock.c
+
+NONPORTABLE_SRCS = \
+ pthread_mutexattr_setkind_np.c \
+ pthread_mutexattr_getkind_np.c \
+ pthread_getw32threadhandle_np.c \
+ pthread_delay_np.c \
+ pthread_num_processors_np.c \
+ pthread_win32_attach_detach_np.c \
+ pthread_timechange_handler_np.c
+
+PRIVATE_SRCS = \
+ ptw32_is_attr.c \
+ ptw32_processInitialize.c \
+ ptw32_processTerminate.c \
+ ptw32_threadStart.c \
+ ptw32_threadDestroy.c \
+ ptw32_tkAssocCreate.c \
+ ptw32_tkAssocDestroy.c \
+ ptw32_callUserDestroyRoutines.c \
+ ptw32_semwait.c \
+ ptw32_timespec.c \
+ ptw32_throw.c \
+ ptw32_InterlockedCompareExchange.c \
+ ptw32_getprocessors.c
+
+RWLOCK_SRCS = \
+ ptw32_rwlock_check_need_init.c \
+ ptw32_rwlock_cancelwrwait.c \
+ pthread_rwlock_init.c \
+ pthread_rwlock_destroy.c \
+ pthread_rwlockattr_init.c \
+ pthread_rwlockattr_destroy.c \
+ pthread_rwlockattr_getpshared.c \
+ pthread_rwlockattr_setpshared.c \
+ pthread_rwlock_rdlock.c \
+ pthread_rwlock_timedrdlock.c \
+ pthread_rwlock_wrlock.c \
+ pthread_rwlock_timedwrlock.c \
+ pthread_rwlock_unlock.c \
+ pthread_rwlock_tryrdlock.c \
+ pthread_rwlock_trywrlock.c
+
+SCHED_SRCS = \
+ pthread_attr_setschedpolicy.c \
+ pthread_attr_getschedpolicy.c \
+ pthread_attr_setschedparam.c \
+ pthread_attr_getschedparam.c \
+ pthread_attr_setinheritsched.c \
+ pthread_attr_getinheritsched.c \
+ pthread_setschedparam.c \
+ pthread_getschedparam.c \
+ sched_get_priority_max.c \
+ sched_get_priority_min.c \
+ sched_setscheduler.c \
+ sched_getscheduler.c \
+ sched_yield.c
+
+SEMAPHORE_SRCS = \
+ sem_init.c \
+ sem_destroy.c \
+ sem_trywait.c \
+ sem_timedwait.c \
+ sem_wait.c \
+ sem_post.c \
+ sem_post_multiple.c \
+ sem_getvalue.c \
+ sem_open.c \
+ sem_close.c \
+ sem_unlink.c \
+ ptw32_increase_semaphore.c \
+ ptw32_decrease_semaphore.c
+
+SPIN_SRCS = \
+ ptw32_spinlock_check_need_init.c \
+ pthread_spin_init.c \
+ pthread_spin_destroy.c \
+ pthread_spin_lock.c \
+ pthread_spin_unlock.c \
+ pthread_spin_trylock.c
+
+SYNC_SRCS = \
+ pthread_detach.c \
+ pthread_join.c
+
+TSD_SRCS = \
+ pthread_key_create.c \
+ pthread_key_delete.c \
+ pthread_setspecific.c \
+ pthread_getspecific.c
+
+
+GCE_DLL = pthreadGCE$(DLL_VER).dll
+GCE_LIB = libpthreadGCE$(DLL_VER).a
+GCE_INLINED_STAMP = pthreadGCE$(DLL_VER).stamp
+
+GC_DLL = pthreadGC$(DLL_VER).dll
+GC_LIB = libpthreadGC$(DLL_VER).a
+GC_INLINED_STAMP = pthreadGC$(DLL_VER).stamp
+
+PTHREAD_DEF = pthread.def
+
+help:
+ @ echo "Run one of the following command lines:"
+ @ echo "make clean GCE (to build the GNU C dll with C++ exception handling)"
+ @ echo "make clean GC (to build the GNU C dll with C cleanup code)"
+ @ echo "make clean GCE-inlined (to build the GNU C inlined dll with C++ exception handling)"
+ @ echo "make clean GC-inlined (to build the GNU C inlined dll with C cleanup code)"
+
+all:
+ @ $(MAKE) clean GCE
+ @ $(MAKE) clean GC
+
+GC:
+ $(MAKE) CC=gcc CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
+
+GCE:
+ $(MAKE) CC=g++ CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
+
+GC-inlined:
+ $(MAKE) CC=gcc XOPT="-DPTW32_BUILD_INLINED" CLEANUP_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP)
+
+GCE-inlined:
+ $(MAKE) CC=g++ XOPT="-DPTW32_BUILD_INLINED" CLEANUP_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
+
+tests:
+ @ cd tests
+ @ $(MAKE) auto
+
+%.pre: %.c
+ $(CC) -E -o $@ $(CFLAGS) $^
+
+%.s: %.c
+ $(CC) -c $(CFLAGS) -Wa,-ahl $^ > $@
+
+%.o: %.rc
+ $(RC) $(RCFLAGS) -o $@ $<
+
+.SUFFIXES: .dll .rc .c .o
+
+.c.o:; $(CC) -c -o $@ $(CFLAGS) $(CLEANUP_FLAGS) $<
+
+
+$(GC_DLL): $(DLL_OBJS)
+ $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS)
+ dlltool -z pthread.def $(DLL_OBJS)
+ dlltool -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
+
+$(GCE_DLL): $(DLL_OBJS)
+ $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS)
+ dlltool -z pthread.def $(DLL_OBJS)
+ dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
+
+$(GC_INLINED_STAMP): $(DLL_INLINED_OBJS)
+ $(CC) $(OPT) $(XOPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
+ dlltool -z pthread.def $(DLL_INLINED_OBJS)
+ dlltool -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
+ echo touched > $(GC_INLINED_STAMP)
+
+$(GCE_INLINED_STAMP): $(DLL_INLINED_OBJS)
+ $(CC) $(OPT) $(XOPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
+ dlltool -z pthread.def $(DLL_INLINED_OBJS)
+ dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
+ echo touched > $(GCE_INLINED_STAMP)
+
+clean:
+ -$(RM) *~
+ -$(RM) *.i
+ -$(RM) *.o
+ -$(RM) *.obj
+ -$(RM) *.exe
+ -$(RM) $(PTHREAD_DEF)
+
+realclean: clean
+ -$(RM) $(GC_LIB)
+ -$(RM) $(GCE_LIB)
+ -$(RM) $(GC_DLL)
+ -$(RM) $(GCE_DLL)
+ -$(RM) $(GC_INLINED_STAMP)
+ -$(RM) $(GCE_INLINED_STAMP)
+
+attr.o: attr.c $(ATTR_SRCS) $(INCL)
+barrier.o: barrier.c $(BARRIER_SRCS) $(INCL)
+cancel.o: cancel.c $(CANCEL_SRCS) $(INCL)
+condvar.o: condvar.c $(CONDVAR_SRCS) $(INCL)
+exit.o: exit.c $(EXIT_SRCS) $(INCL)
+misc.o: misc.c $(MISC_SRCS) $(INCL)
+mutex.o: mutex.c $(MUTEX_SRCS) $(INCL)
+nonportable.o: nonportable.c $(NONPORTABLE_SRCS) $(INCL)
+private.o: private.c $(PRIVATE_SRCS) $(INCL)
+rwlock.o: rwlock.c $(RWLOCK_SRCS) $(INCL)
+sched.o: sched.c $(SCHED_SRCS) $(INCL)
+semaphore.o: semaphore.c $(SEMAPHORE_SRCS) $(INCL)
+spin.o: spin.c $(SPIN_SRCS) $(INCL)
+sync.o: sync.c $(SYNC_SRCS) $(INCL)
+tsd.o: tsd.c $(TSD_SRCS) $(INCL)
+version.o: version.rc $(INCL)
diff --git a/README.Borland b/README.Borland
index 5aca71c..ffb6e8d 100644
--- a/README.Borland
+++ b/README.Borland
@@ -1,46 +1,60 @@
-In ptw32_InterlockedCompareExchange.c, I've added a section for
-Borland's compiler; it's identical to that for the MS compiler except
+In ptw32_InterlockedCompareExchange.c, I've added a section for
+Borland's compiler; it's identical to that for the MS compiler except
that it uses /* ... */ comments instead of ; comments.
-The other file is a makefile suitable for use with Borland's compiler
-(run "make -fBmakefile" in the directory). It builds a single version
-of the library, pthreadBC.dll and the corresponding pthreadBC.lib
-import library, which is comparable to the pthreadVC version; I can't
-personally see any demand for the versions that include structured or
-C++ exception cancellation handling so I haven't attempted to build
-those versions of the library. (I imagine a static version might be
-of use to some, but we can't legally use that on my commercial
-projects so I can't try that out, unfortunately.)
-
-Borland C++ doesn't define the ENOSYS constant used by pthreads-win32;
-rather than make more extensive patches to the pthreads-win32 source I
-have a mostly-arbitrary constant for it in the makefile. However this
-doesn't make it visible to the application using the library, so if
-anyone actually wants to use this constant in their apps (why?)
-someone might like to make a seperate NEED_BCC_something define to add
-this stuff.
-
-The makefile also #defines EDEADLK as EDEADLOCK, _timeb as timeb, and
-_ftime as ftime, to deal with the minor differences between the two
-RTLs' naming conventions, and sets the compiler flags as required to
-get a normal compile of the library.
-
-
-(While I'm on the subject, the reason Borland users should recompile
-the library, rather than using the impdef/implib technique suggested
-previously on the mailing list, is that a) the errno constants are
-different, so the results returned by the pthread_* functions can be
-meaningless, and b) the errno variable/pseudo-variable itself is
-different in the MS & BCC runtimes, so you can't access the
-pthreadVC's errno from a Borland C++-compiled host application
-correctly - I imagine there are other potential problems from the RTL
-mismatch too.)
-
-Best regards,
-Will
-
---
-Will Bryant
-Systems Architect, eCOSM Limited
-Cell +64 21 655 443, office +64 3 365 4176
-http://www.ecosm.com/
+[RPJ: need to define HAVE_TASM32 in config.h to use the above.]
+
+
+The other file is a makefile suitable for use with Borland's compiler
+(run "make -fBmakefile" in the directory). It builds a single version
+of the library, pthreadBC.dll and the corresponding pthreadBC.lib
+import library, which is comparable to the pthreadVC version; I can't
+personally see any demand for the versions that include structured or
+C++ exception cancellation handling so I haven't attempted to build
+those versions of the library. (I imagine a static version might be
+of use to some, but we can't legally use that on my commercial
+projects so I can't try that out, unfortunately.)
+
+[RPJ: Added tests\Bmakefile as well.]
+
+Borland C++ doesn't define the ENOSYS constant used by pthreads-win32;
+rather than make more extensive patches to the pthreads-win32 source I
+have a mostly-arbitrary constant for it in the makefile. However this
+doesn't make it visible to the application using the library, so if
+anyone actually wants to use this constant in their apps (why?)
+someone might like to make a seperate NEED_BCC_something define to add
+this stuff.
+
+The makefile also #defines EDEADLK as EDEADLOCK, _timeb as timeb, and
+_ftime as ftime, to deal with the minor differences between the two
+RTLs' naming conventions, and sets the compiler flags as required to
+get a normal compile of the library.
+
+[RPJ: Moved errno values and _timeb etc to pthread.h, so apps will also
+use them.]
+
+(While I'm on the subject, the reason Borland users should recompile
+the library, rather than using the impdef/implib technique suggested
+previously on the mailing list, is that a) the errno constants are
+different, so the results returned by the pthread_* functions can be
+meaningless, and b) the errno variable/pseudo-variable itself is
+different in the MS & BCC runtimes, so you can't access the
+pthreadVC's errno from a Borland C++-compiled host application
+correctly - I imagine there are other potential problems from the RTL
+mismatch too.)
+
+[RPJ: There are still problems with errno under Borland and the DLL
+will not pass the testsuite yet because of it. Setting and then reading
+errno from within the same DLL, or the same application module is fine,
+but DLL and application modules do not seem to be looking at the same
+location for errno, even though they are logically running in the same
+thread.]
+
+Best regards,
+Will
+
+--
+Will Bryant
+Systems Architect, eCOSM Limited
+Cell +64 21 655 443, office +64 3 365 4176
+http://www.ecosm.com/
diff --git a/config.h b/config.h
index a27fd01..8d581c8 100644
--- a/config.h
+++ b/config.h
@@ -16,6 +16,9 @@
/* Define if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
+/* Define if you have the Borland TASM32 or compatible assembler. */
+#undef HAVE_TASM32
+
/* Define if you don't have Win32 DuplicateHandle. (eg. WinCE) */
#undef NEED_DUPLICATEHANDLE
@@ -87,6 +90,9 @@
/*********************************************************************
* Target specific groups
+ *
+ * If you find that these are incorrect or incomplete please report it
+ * to the pthreads-win32 maintainer. Thanks.
*********************************************************************/
#ifdef WINCE
#define NEED_DUPLICATEHANDLE
@@ -112,6 +118,9 @@
#define HAVE_MODE_T
#endif
+#ifdef __BORLANDC__
+#endif
+
#ifdef __WATCOMC__
#endif
diff --git a/ptw32_InterlockedCompareExchange.c b/ptw32_InterlockedCompareExchange.c
index 8d2cd85..581d19d 100644
--- a/ptw32_InterlockedCompareExchange.c
+++ b/ptw32_InterlockedCompareExchange.c
@@ -73,7 +73,7 @@ ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location,
#if defined(_M_IX86) || defined(_X86_)
-#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(X__BORLANDC__)
+#if defined(_MSC_VER) || defined(__WATCOMC__) || (defined(__BORLANDC__) && defined(HAVE_TASM32))
#define HAVE_INLINABLE_INTERLOCKED_CMPXCHG
{
@@ -184,7 +184,7 @@ ptw32_InterlockedExchange (LPLONG location,
#if defined(_M_IX86) || defined(_X86_)
-#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(X__BORLANDC__)
+#if defined(_MSC_VER) || defined(__WATCOMC__) || (defined(__BORLANDC__) && defined(HAVE_TASM32))
#define HAVE_INLINABLE_INTERLOCKED_XCHG
{
diff --git a/tests/Bmakefile b/tests/Bmakefile
index 4d5b956..94b5395 100644
--- a/tests/Bmakefile
+++ b/tests/Bmakefile
@@ -70,7 +70,6 @@ BUILD_DIR=..
COPYFILES = $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
-TEST =
EHFLAGS =
# If a test case returns a non-zero exit code to the shell, make will
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index efd8f25..dda1283 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -1,332 +1,332 @@
-# 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 = 1
-
-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
-
-#
-# Mingw32
-#
-XXCFLAGS =
-XXLIBS = -lws2_32
-#CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
-CFLAGS = -g -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
-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 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 tsd1 self2 \
- cancel1 cancel2 \
- semaphore4 semaphore4t \
- 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 \
- barrier1 barrier2 barrier3 barrier4 barrier5 \
- exception1 exception2 exception3 \
- cancel9 create3
-
-BENCHTESTS = \
- benchtest1 benchtest2 benchtest3 benchtest4 benchtest5
-
-PASSES = $(TESTS:%=%.pass)
-BENCHRESULTS = $(BENCHTESTS:%=%.bench)
-
-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)"
-
-all:
- @ $(MAKE) clean GC
- @ $(MAKE) clean GCX
- @ $(MAKE) clean GCE
-
-GC:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C" all-pass
-
-GCE:
- $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-mthreads -D__CLEANUP_CXX" all-pass
-
-GCX:
- $(MAKE) TEST=GC CC=g++ XXCFLAGS="-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
-
-all-pass: $(PASSES)
- @ $(ECHO) ALL TESTS PASSED! Congratulations!
-
-all-bench: $(BENCHRESULTS)
- @ $(ECHO) BENCH TESTS 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
-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
-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
-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
-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
-sizes.pass:
-spin1.pass:
-spin2.pass: spin1.pass
-spin3.pass: spin2.pass
-spin4.pass: spin3.pass
-tsd1.pass: join1.pass
-valid1.pass: join1.pass
-valid2.pass: valid1.pass
-cancel9.pass: cancel8.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 $@
- @ $(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) *.obj
- - $(RM) *.pdb
- - $(RM) *.exe
- - $(RM) *.pass
- - $(RM) *.bench
- - $(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 = 1
+
+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
+
+#
+# Mingw32
+#
+XXCFLAGS =
+XXLIBS = -lws2_32
+#CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
+CFLAGS = -g -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
+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 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 tsd1 self2 \
+ cancel1 cancel2 \
+ semaphore4 semaphore4t \
+ 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 \
+ barrier1 barrier2 barrier3 barrier4 barrier5 \
+ exception1 exception2 exception3 \
+ cancel9 create3
+
+BENCHTESTS = \
+ benchtest1 benchtest2 benchtest3 benchtest4 benchtest5
+
+PASSES = $(TESTS:%=%.pass)
+BENCHRESULTS = $(BENCHTESTS:%=%.bench)
+
+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)"
+
+all:
+ @ $(MAKE) clean GC
+ @ $(MAKE) clean GCX
+ @ $(MAKE) clean GCE
+
+GC:
+ $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C" all-pass
+
+GCE:
+ $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-mthreads -D__CLEANUP_CXX" all-pass
+
+GCX:
+ $(MAKE) TEST=GC CC=g++ XXCFLAGS="-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
+
+all-pass: $(PASSES)
+ @ $(ECHO) ALL TESTS PASSED! Congratulations!
+
+all-bench: $(BENCHRESULTS)
+ @ $(ECHO) BENCH TESTS 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
+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
+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
+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
+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
+sizes.pass:
+spin1.pass:
+spin2.pass: spin1.pass
+spin3.pass: spin2.pass
+spin4.pass: spin3.pass
+tsd1.pass: join1.pass
+valid1.pass: join1.pass
+valid2.pass: valid1.pass
+cancel9.pass: cancel8.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 $@
+ @ $(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) *.obj
+ - $(RM) *.pdb
+ - $(RM) *.exe
+ - $(RM) *.pass
+ - $(RM) *.bench
+ - $(RM) *.log
diff --git a/tests/Wmakefile b/tests/Wmakefile
index cc82b49..a7005b9 100644
--- a/tests/Wmakefile
+++ b/tests/Wmakefile
@@ -32,7 +32,7 @@
#
-DLL_VER = 1
+DLL_VER = 1
.EXTENSIONS:
@@ -78,8 +78,8 @@ EHFLAGS =
PASSES = sizes.pass loadfree.pass &
self1.pass mutex5.pass &
- mutex1.pass mutex1n.pass mutex1e.pass mutex1r.pass &
- semaphore1.pass semaphore2.pass semaphore3.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 &
@@ -94,13 +94,13 @@ PASSES = sizes.pass loadfree.pass &
count1.pass once1.pass tsd1.pass &
self2.pass &
cancel1.pass cancel2.pass &
- semaphore4.pass semaphore4t.pass &
+ semaphore4.pass semaphore4t.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 &
+ 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 &
diff --git a/version.rc b/version.rc
index cc6ccc6..90b78cb 100644
--- a/version.rc
+++ b/version.rc
@@ -33,7 +33,16 @@
#include <winver.h>
#include "pthread.h"
-#ifdef _MS_VER
+/*
+ * Note: the correct __CLEANUP_* macro must be defined corresponding to
+ * the definition used for the object file builds. This is done in the
+ * relevent makefiles for the command line builds, but users should ensure
+ * that their resource compiler knows what it is too.
+ * If using the default (no __CLEANUP_* defined), pthread.h will define it
+ * as __CLEANUP_C.
+ */
+
+#ifdef PTW32_RC_MSC
# if defined(__CLEANUP_C)
# define PTW32_VERSIONINFO_NAME "pthreadVC\0"
# define PTW32_VERSIONINFO_COMMENT "MS C build -- longjmp thread exiting\0"
@@ -43,6 +52,8 @@
# elif defined(__CLEANUP_SEH)
# define PTW32_VERSIONINFO_NAME "pthreadVSE\0"
# define PTW32_VERSIONINFO_COMMENT "MS C build -- structured exception thread exiting\0"
+# else
+# error Resource compiler doesn't know which cleanup style you're using - see version.rc
# endif
#elif defined(__GNUC__)
# if defined(__CLEANUP_C)
@@ -51,7 +62,31 @@
# elif defined(__CLEANUP_CXX)
# define PTW32_VERSIONINFO_NAME "pthreadGCE\0"
# define PTW32_VERSIONINFO_COMMENT "GNU C++ build -- C++ exception thread exiting\0"
+# else
+# error Resource compiler doesn't know which cleanup style you're using - see version.rc
+# endif
+#elif defined(__BORLANDC__)
+# if defined(__CLEANUP_C)
+# define PTW32_VERSIONINFO_NAME "pthreadBC\0"
+# define PTW32_VERSIONINFO_COMMENT "BORLAND C build -- longjmp thread exiting\0"
+# elif defined(__CLEANUP_CXX)
+# define PTW32_VERSIONINFO_NAME "pthreadBCE\0"
+# define PTW32_VERSIONINFO_COMMENT "BORLAND C++ build -- C++ exception thread exiting\0"
+# else
+# error Resource compiler doesn't know which cleanup style you're using - see version.rc
+# endif
+#elif defined(__WATCOMC__)
+# if defined(__CLEANUP_C)
+# define PTW32_VERSIONINFO_NAME "pthreadWC\0"
+# define PTW32_VERSIONINFO_COMMENT "WATCOM C build -- longjmp thread exiting\0"
+# elif defined(__CLEANUP_CXX)
+# define PTW32_VERSIONINFO_NAME "pthreadWCE\0"
+# define PTW32_VERSIONINFO_COMMENT "WATCOM C++ build -- C++ exception thread exiting\0"
+# else
+# error Resource compiler doesn't know which cleanup style you're using - see version.rc
# endif
+#else
+# error Resource compiler doesn't know which compiler you're using - see version.rc
#endif
@@ -73,7 +108,7 @@ BEGIN
VALUE "InternalName", PTW32_VERSIONINFO_NAME
VALUE "OriginalFilename", PTW32_VERSIONINFO_NAME
VALUE "CompanyName", "Open Source Software community project\0"
- VALUE "LegalCopyright", "Copyright (C) Project contributors 1998-2005\0"
+ VALUE "LegalCopyright", "Copyright (C) Project contributors 1998-2004\0"
VALUE "Licence", "LGPL\0"
VALUE "Info", "http://sources.redhat.com/pthreads-win32/\0"
VALUE "Comment", PTW32_VERSIONINFO_COMMENT