Skip to content

Commit

Permalink
See ChangeLog
Browse files Browse the repository at this point in the history
  • Loading branch information
rpj committed Jan 6, 2007
1 parent eeef426 commit 35dec51
Show file tree
Hide file tree
Showing 30 changed files with 124 additions and 46 deletions.
2 changes: 1 addition & 1 deletion ANNOUNCE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
44 changes: 44 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
6 changes: 5 additions & 1 deletion context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion create.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include "pthread.h"
#include "implement.h"
#ifndef _UWIN
#if ! defined(_UWIN) && ! defined(WINCE)
#include <process.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion errno.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ _errno (void)
}
else
{
result = &(self->ptErrno);
result = (int *)(&self.p->exitStatus);
}

return (result);
Expand Down
2 changes: 1 addition & 1 deletion exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include "pthread.h"
#include "implement.h"
#ifndef _UWIN
#if ! defined(_UWIN) && ! defined(WINCE)
# include <process.h>
#endif

Expand Down
25 changes: 19 additions & 6 deletions implement.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -658,7 +659,9 @@ extern "C"
# endif
# endif
#else
# include <process.h>
# ifndef WINCE
# include <process.h>
# endif
#endif


Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 19 additions & 12 deletions pthread_cond_destroy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion pthread_detach.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion pthread_join.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion pthread_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_destroy.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_rdlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_timedrdlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_timedwrlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_tryrdlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_trywrlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_unlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlock_wrlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlockattr_destroy.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlockattr_getpshared.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlockattr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
1 change: 0 additions & 1 deletion pthread_rwlockattr_setpshared.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/

#include <errno.h>
#include <limits.h>

#include "pthread.h"
Expand Down
2 changes: 1 addition & 1 deletion ptw32_MCS_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
* }
*/

#include "implement.h"
#include "pthread.h"
#include "implement.h"

/*
* ptw32_mcs_flag_set -- notify another thread about an event.
Expand Down
19 changes: 18 additions & 1 deletion ptw32_semwait.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 35dec51

Please sign in to comment.