diff -urp src.old/winsup/cygwin/thread.cc src/winsup/cygwin/thread.cc --- src.old/winsup/cygwin/thread.cc 2003-03-19 14:22:24.000000000 +0100 +++ src/winsup/cygwin/thread.cc 2003-03-19 14:27:45.000000000 +0100 @@ -934,11 +934,11 @@ pthread_cond::Wait (pthread_mutex_t mute DWORD rv; mtxIn.Lock (); - if (1 == InterlockedIncrement ((long *)&waiting)) + if (1 == InterlockedIncrementUL (&waiting)) mtxCond = mutex; else if (mtxCond != mutex) { - InterlockedDecrement ((long *)&waiting); + InterlockedDecrementUL (&waiting); mtxIn.UnLock (); return EINVAL; } @@ -969,7 +969,7 @@ pthread_cond::Wait (pthread_mutex_t mute rv = WAIT_OBJECT_0; } - InterlockedDecrement ((long *)&waiting); + InterlockedDecrementUL (&waiting); if (rv == WAIT_OBJECT_0 && 0 == --pending) /* @@ -1596,11 +1596,11 @@ pthread_mutex::_Lock (pthread_t self) { int result = 0; - if (1 == InterlockedIncrement ((long *)&lock_counter)) + if (1 == InterlockedIncrementUL (&lock_counter)) SetOwner (self); else if (PTHREAD_MUTEX_NORMAL != type && pthread_equal (owner, self)) { - InterlockedDecrement ((long *) &lock_counter); + InterlockedDecrementUL (&lock_counter); if (PTHREAD_MUTEX_RECURSIVE == type) result = LockRecursive (); else @@ -1620,7 +1620,7 @@ pthread_mutex::_TryLock (pthread_t self) { int result = 0; - if (0 == InterlockedCompareExchange ((long *)&lock_counter, 1, 0 )) + if (0 == InterlockedCompareExchangeUL (&lock_counter, 1, 0 )) SetOwner (self); else if (PTHREAD_MUTEX_RECURSIVE == type && pthread_equal (owner, self)) result = LockRecursive (); @@ -1639,7 +1639,7 @@ pthread_mutex::_UnLock (pthread_t self) if (0 == --recursion_counter) { owner = NULL; - if (InterlockedDecrement ((long *)&lock_counter)) + if (InterlockedDecrementUL (&lock_counter)) // Another thread is waiting ::ReleaseSemaphore (win32_obj_id, 1, NULL); } diff -urp src.old/winsup/cygwin/winbase.h src/winsup/cygwin/winbase.h --- src.old/winsup/cygwin/winbase.h 2003-03-19 14:23:15.000000000 +0100 +++ src/winsup/cygwin/winbase.h 2003-03-19 14:25:20.000000000 +0100 @@ -57,6 +57,30 @@ ilockcmpexch (long *t, long v, long c) #undef InterlockedCompareExchange #define InterlockedCompareExchange ilockcmpexch +extern __inline__ unsigned long +InterlockedIncrementUL (unsigned long *m) +{ + return (unsigned long) InterlockedIncrement ((long*) m); +} + +extern __inline__ unsigned long +InterlockedDecrementUL(unsigned long *m) +{ + return (unsigned long) InterlockedDecrement ((long*) m); +} + +extern __inline__ unsigned long +InterlockedExchangeUL (unsigned long *t, unsigned long v) +{ + return (unsigned long) InterlockedExchange ((long*) t, (long) v); +} + +extern __inline__ unsigned long +InterlockedCompareExchangeUL(unsigned long *t, unsigned long v, unsigned long c) +{ + return (unsigned long) InterlockedCompareExchange ((long*) t, (long) v, (long) c); +} + #ifndef EXPCGf #define DECLARE_TLS_STORAGE do {} while (0) #else