summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ANNOUNCE2
-rw-r--r--ChangeLog44
-rw-r--r--Makefile2
-rw-r--r--context.h6
-rw-r--r--create.c2
-rw-r--r--errno.c2
-rw-r--r--exit.c2
-rw-r--r--implement.h25
-rw-r--r--mutex.c2
-rw-r--r--pthread.h4
-rw-r--r--pthread_cond_destroy.c31
-rw-r--r--pthread_detach.c4
-rw-r--r--pthread_join.c4
-rw-r--r--pthread_kill.c4
-rw-r--r--pthread_rwlock_destroy.c1
-rw-r--r--pthread_rwlock_init.c1
-rw-r--r--pthread_rwlock_rdlock.c1
-rw-r--r--pthread_rwlock_timedrdlock.c1
-rw-r--r--pthread_rwlock_timedwrlock.c1
-rw-r--r--pthread_rwlock_tryrdlock.c1
-rw-r--r--pthread_rwlock_trywrlock.c1
-rw-r--r--pthread_rwlock_unlock.c1
-rw-r--r--pthread_rwlock_wrlock.c1
-rw-r--r--pthread_rwlockattr_destroy.c1
-rw-r--r--pthread_rwlockattr_getpshared.c1
-rw-r--r--pthread_rwlockattr_init.c1
-rw-r--r--pthread_rwlockattr_setpshared.c1
-rw-r--r--ptw32_MCS_lock.c2
-rw-r--r--ptw32_semwait.c19
-rw-r--r--tests/Makefile2
30 files changed, 124 insertions, 46 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index 97d94e7..d15d18a 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,4 +1,4 @@
- PTHREADS-WIN32 RELEASE 2.8.0 (2006-12-22)
+ PTHREADS-WIN32 RELEASE 2.9.0 (2007-??-??)
-----------------------------------------
Web Site: http://sources.redhat.com/pthreads-win32/
FTP Site: ftp://sources.redhat.com/pub/pthreads-win32
diff --git a/ChangeLog b/ChangeLog
index d9feacc..aa4bae3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2007-01-06 Ross Johnson <ross.johnson at homemail dot com dot au>
+
+ * ptw32_semwait.c: Add check for invalid sem_t after acquiring the
+ sem_t state guard mutex and before affecting changes to sema state.
+
+2007-01-06 Marcel Ruff <mr at marcelruff dot info>
+
+ * error.c: Fix reference to pthread handle exitStatus member for
+ builds that use NEED_ERRNO (i.e. WINCE).
+ * context.h: Add support for ARM processor (WinCE).
+ * mutex.c (process.h): Exclude for WINCE.
+ * create.c: Likewise.
+ * exit.c: Likewise.
+ * implement.h: Likewise.
+ * pthread_detach.c (signal.h): Exclude for WINCE.
+ * pthread_join.c: Likewise.
+ * pthread_kill.c: Likewise.
+ * pthread_rwlock_init.c (errno.h): Remove - included by pthread.h.
+ * pthread_rwlock_destroy.c: Likewise.
+ * pthread_rwlock_rdlock.c: Likewise.
+ * pthread_rwlock_timedrdlock.c: Likewise.
+ * pthread_rwlock_timedwrlock.c: Likewise.
+ * pthread_rwlock_tryrdlock.c: Likewise.
+ * pthread_rwlock_trywrlock.c: likewise.
+ * pthread_rwlock_unlock.c: Likewise.
+ * pthread_rwlock_wrlock.c: Likewise.
+ * pthread_rwlockattr_destroy.c: Likewise.
+ * pthread_rwlockattr_getpshared.c: Likewise.
+ * pthread_rwlockattr_init.c: Likewise.
+ * pthread_rwlockattr_setpshared.c: Likewise.
+
+2007-01-06 Romano Paolo Tenca <rotenca at telvia dot it>
+
+ * pthread_cond_destroy.c: Replace sem_wait() with non-cancelable
+ ptw32_semwait() since pthread_cond_destroy() is not a cancelation
+ point.
+ * implement.h (ptw32_spinlock_check_need_init): Add prototype.
+ * ptw32_MCS_lock.c: Reverse order of includes.
+
+2007-01-06 Eric Berge <eric dot berge at quantum dot com>
+
+ * pthread_cond_destroy.c: Add LeaveCriticalSection before returning
+ after errors.
+
2007-01-04 Ross Johnson <ross.johnson at homemail dot com dot au>
* ptw32_InterlockedCompareExchange.c: Conditionally skip for
diff --git a/Makefile b/Makefile
index 162a08e..82bb625 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ STATIC_STAMPS = pthreadVCE$(DLL_VER).static pthreadVSE$(DLL_VER).static pthreadV
OPTIM = /O2 /Ob2
OPTIMD =
-CFLAGS = /W3 /MD /nologo /Yd /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H
+CFLAGS = /W3 /MD /nologo /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H
CFLAGSD = /Zi $(CFLAGS)
diff --git a/context.h b/context.h
index 3a399ff..871aa3f 100644
--- a/context.h
+++ b/context.h
@@ -47,7 +47,7 @@
#define PTW32_PROGCTR(Context) ((Context).StIIP)
#endif
-#if defined(_MIPS_)
+#if defined(_MIPS_) || defined(MIPS)
#define PTW32_PROGCTR(Context) ((Context).Fir)
#endif
@@ -63,6 +63,10 @@
#define PTW32_PROGCTR(Context) ((Context).Rip)
#endif
+#if defined(_ARM_) || defined(ARM)
+#define PTW32_PROGCTR(Context) ((Context).Pc)
+#endif
+
#if !defined(PTW32_PROGCTR)
#error Module contains CPU-specific code; modify and recompile.
#endif
diff --git a/create.c b/create.c
index 9e9388b..55b932a 100644
--- a/create.c
+++ b/create.c
@@ -37,7 +37,7 @@
#include "pthread.h"
#include "implement.h"
-#ifndef _UWIN
+#if ! defined(_UWIN) && ! defined(WINCE)
#include <process.h>
#endif
diff --git a/errno.c b/errno.c
index 9998bb8..1a7957c 100644
--- a/errno.c
+++ b/errno.c
@@ -84,7 +84,7 @@ _errno (void)
}
else
{
- result = &(self->ptErrno);
+ result = (int *)(&self.p->exitStatus);
}
return (result);
diff --git a/exit.c b/exit.c
index 7eb9671..94369d0 100644
--- a/exit.c
+++ b/exit.c
@@ -37,7 +37,7 @@
#include "pthread.h"
#include "implement.h"
-#ifndef _UWIN
+#if ! defined(_UWIN) && ! defined(WINCE)
# include <process.h>
#endif
diff --git a/implement.h b/implement.h
index 82a7a8f..cf3c7f4 100644
--- a/implement.h
+++ b/implement.h
@@ -566,6 +566,7 @@ extern "C"
int ptw32_cond_check_need_init (pthread_cond_t * cond);
int ptw32_mutex_check_need_init (pthread_mutex_t * mutex);
int ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock);
+ int ptw32_spinlock_check_need_init (pthread_spinlock_t * spinlock);
PTW32_INTERLOCKED_LONG WINAPI
ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location,
@@ -658,7 +659,9 @@ extern "C"
# endif
# endif
#else
-# include <process.h>
+# ifndef WINCE
+# include <process.h>
+# endif
#endif
@@ -667,11 +670,21 @@ extern "C"
* See ptw32_InterlockedCompareExchange.c
*/
#ifndef PTW32_INTERLOCKED_COMPARE_EXCHANGE
-#ifdef _WIN64
-#define PTW32_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
-#else
-#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_interlocked_compare_exchange
-#endif
+# ifdef _WIN64
+ /*
+ * InterlockedCompareExchange is an intrinsic function in Win64.
+ */
+# define PTW32_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
+# else
+ /*
+ * The routine pthread_win32_process_attach_np() in pthread_win32_attach_detach_np.c
+ * checks at runtime that InterlockedCompareExchange is supported within
+ * KERNEL32.DLL (or COREDLL.DLL for WinCE). This allows the same
+ * dll to run on all Win32 versions from Win95 onwards. Not sure if this
+ * is required for WinCE, but should work just the same anyway.
+ */
+# define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_interlocked_compare_exchange
+# endif
#endif
#ifndef PTW32_INTERLOCKED_EXCHANGE
diff --git a/mutex.c b/mutex.c
index 2e60dab..0b03a45 100644
--- a/mutex.c
+++ b/mutex.c
@@ -34,7 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#ifndef _UWIN
+#if ! defined(_UWIN) && ! defined(WINCE)
# include <process.h>
#endif
#ifndef NEED_FTIME
diff --git a/pthread.h b/pthread.h
index f3d2dac..1fd465b 100644
--- a/pthread.h
+++ b/pthread.h
@@ -37,8 +37,8 @@
* See the README file for an explanation of the pthreads-win32 version
* numbering scheme and how the DLL is named etc.
*/
-#define PTW32_VERSION 2,8,0,0
-#define PTW32_VERSION_STRING "2, 8, 0, 0\0"
+#define PTW32_VERSION 2,9,0,0
+#define PTW32_VERSION_STRING "2, 9, 0, 0\0"
/* There are three implementations of cancel cleanup.
* Note that pthread.h is included in both application
diff --git a/pthread_cond_destroy.c b/pthread_cond_destroy.c
index 3d29ffc..53f7a53 100644
--- a/pthread_cond_destroy.c
+++ b/pthread_cond_destroy.c
@@ -135,21 +135,28 @@ pthread_cond_destroy (pthread_cond_t * cond)
* all already signaled waiters to let them retract their
* waiter status - SEE NOTE 1 ABOVE!!!
*/
- if (sem_wait (&(cv->semBlockLock)) != 0)
+ if (ptw32_semwait (&(cv->semBlockLock)) != 0) /* Non-cancelable */
{
- return errno;
+ result = errno;
}
-
- /*
- * !TRY! lock mtxUnblockLock; try will detect busy condition
- * and will not cause a deadlock with respect to concurrent
- * signal/broadcast.
- */
- if ((result = pthread_mutex_trylock (&(cv->mtxUnblockLock))) != 0)
- {
- (void) sem_post (&(cv->semBlockLock));
- return result;
+ else
+ {
+ /*
+ * !TRY! lock mtxUnblockLock; try will detect busy condition
+ * and will not cause a deadlock with respect to concurrent
+ * signal/broadcast.
+ */
+ if ((result = pthread_mutex_trylock (&(cv->mtxUnblockLock))) != 0)
+ {
+ (void) sem_post (&(cv->semBlockLock));
+ }
}
+
+ if (result != 0)
+ {
+ LeaveCriticalSection (&ptw32_cond_list_lock);
+ return result;
+ }
/*
* Check whether cv is still busy (still has waiters)
diff --git a/pthread_detach.c b/pthread_detach.c
index 00fb6ad..b110f2b 100644
--- a/pthread_detach.c
+++ b/pthread_detach.c
@@ -42,7 +42,9 @@
* Not needed yet, but defining it should indicate clashes with build target
* environment that should be fixed.
*/
-#include <signal.h>
+#ifndef WINCE
+# include <signal.h>
+#endif
int
diff --git a/pthread_join.c b/pthread_join.c
index 8237b6c..72a3a74 100644
--- a/pthread_join.c
+++ b/pthread_join.c
@@ -42,7 +42,9 @@
* Not needed yet, but defining it should indicate clashes with build target
* environment that should be fixed.
*/
-#include <signal.h>
+#ifndef WINCE
+# include <signal.h>
+#endif
int
diff --git a/pthread_kill.c b/pthread_kill.c
index 7de3fe2..d360187 100644
--- a/pthread_kill.c
+++ b/pthread_kill.c
@@ -41,7 +41,9 @@
* Not needed yet, but defining it should indicate clashes with build target
* environment that should be fixed.
*/
-#include <signal.h>
+#ifndef WINCE
+# include <signal.h>
+#endif
int
pthread_kill (pthread_t thread, int sig)
diff --git a/pthread_rwlock_destroy.c b/pthread_rwlock_destroy.c
index 5a747ed..d14b447 100644
--- a/pthread_rwlock_destroy.c
+++ b/pthread_rwlock_destroy.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_init.c b/pthread_rwlock_init.c
index 3e3f448..597c1ff 100644
--- a/pthread_rwlock_init.c
+++ b/pthread_rwlock_init.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_rdlock.c b/pthread_rwlock_rdlock.c
index dba63dd..91e1808 100644
--- a/pthread_rwlock_rdlock.c
+++ b/pthread_rwlock_rdlock.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_timedrdlock.c b/pthread_rwlock_timedrdlock.c
index 9348950..7133778 100644
--- a/pthread_rwlock_timedrdlock.c
+++ b/pthread_rwlock_timedrdlock.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_timedwrlock.c b/pthread_rwlock_timedwrlock.c
index e7d1be2..5de1e48 100644
--- a/pthread_rwlock_timedwrlock.c
+++ b/pthread_rwlock_timedwrlock.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_tryrdlock.c b/pthread_rwlock_tryrdlock.c
index 308900d..0fc5458 100644
--- a/pthread_rwlock_tryrdlock.c
+++ b/pthread_rwlock_tryrdlock.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_trywrlock.c b/pthread_rwlock_trywrlock.c
index 8ba8b5d..9997c5d 100644
--- a/pthread_rwlock_trywrlock.c
+++ b/pthread_rwlock_trywrlock.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_unlock.c b/pthread_rwlock_unlock.c
index 776c996..d48d187 100644
--- a/pthread_rwlock_unlock.c
+++ b/pthread_rwlock_unlock.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlock_wrlock.c b/pthread_rwlock_wrlock.c
index a097040..174fcbc 100644
--- a/pthread_rwlock_wrlock.c
+++ b/pthread_rwlock_wrlock.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlockattr_destroy.c b/pthread_rwlockattr_destroy.c
index 0fcbe84..868e727 100644
--- a/pthread_rwlockattr_destroy.c
+++ b/pthread_rwlockattr_destroy.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlockattr_getpshared.c b/pthread_rwlockattr_getpshared.c
index abfe63f..eeace20 100644
--- a/pthread_rwlockattr_getpshared.c
+++ b/pthread_rwlockattr_getpshared.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlockattr_init.c b/pthread_rwlockattr_init.c
index feb8e94..a2d2b94 100644
--- a/pthread_rwlockattr_init.c
+++ b/pthread_rwlockattr_init.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/pthread_rwlockattr_setpshared.c b/pthread_rwlockattr_setpshared.c
index 316532c..a83dd70 100644
--- a/pthread_rwlockattr_setpshared.c
+++ b/pthread_rwlockattr_setpshared.c
@@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#include <errno.h>
#include <limits.h>
#include "pthread.h"
diff --git a/ptw32_MCS_lock.c b/ptw32_MCS_lock.c
index 1a143ea..6b797c5 100644
--- a/ptw32_MCS_lock.c
+++ b/ptw32_MCS_lock.c
@@ -89,8 +89,8 @@
* }
*/
-#include "implement.h"
#include "pthread.h"
+#include "implement.h"
/*
* ptw32_mcs_flag_set -- notify another thread about an event.
diff --git a/ptw32_semwait.c b/ptw32_semwait.c
index 8b23d11..111cb80 100644
--- a/ptw32_semwait.c
+++ b/ptw32_semwait.c
@@ -77,8 +77,18 @@ ptw32_semwait (sem_t * sem)
{
if ((result = pthread_mutex_lock (&s->lock)) == 0)
{
- int v = --s->value;
+ int v;
+ /* See sem_destroy.c
+ */
+ if (*sem == NULL)
+ {
+ (void) pthread_mutex_unlock (&s->lock);
+ errno = EINVAL;
+ return -1;
+ }
+
+ v = --s->value;
(void) pthread_mutex_unlock (&s->lock);
if (v < 0)
@@ -89,6 +99,13 @@ ptw32_semwait (sem_t * sem)
#ifdef NEED_SEM
if (pthread_mutex_lock (&s->lock) == 0)
{
+ if (*sem == NULL)
+ {
+ (void) pthread_mutex_unlock (&s->lock);
+ errno = EINVAL;
+ return -1;
+ }
+
if (s->leftToUnblock > 0)
{
--s->leftToUnblock;
diff --git a/tests/Makefile b/tests/Makefile
index 69dc39c..57fd2f4 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -67,7 +67,7 @@ VCXFLAGS = /GX /TP /D__CLEANUP_C
CPLIB = $(VCLIB)
CPDLL = $(VCDLL)
-CFLAGS= $(OPTIM) /W3 /WX /MD /nologo /Yd /Zi
+CFLAGS= $(OPTIM) /W3 /WX /MD /nologo /Zi
LFLAGS= /INCREMENTAL:NO
INCLUDES=-I.
BUILD_DIR=..