backout bug 415563 because a gcc4.3 bug causes it to break our 32bit linux builders r=ted

This commit is contained in:
Brad Lassey 2010-06-05 13:15:50 -04:00
parent a27454a03b
commit 18d49dc041
6 changed files with 15 additions and 17 deletions

View File

@ -125,12 +125,10 @@ long __cdecl _InterlockedExchange(long volatile *Target, long Value);
long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value); long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value);
#pragma intrinsic(_InterlockedExchangeAdd) #pragma intrinsic(_InterlockedExchangeAdd)
#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement((long volatile *)val) #define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement(val)
#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement((long volatile *)val) #define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement(val)
#define PR_ATOMIC_SET(val, newval) \ #define PR_ATOMIC_SET(val, newval) _InterlockedExchange(val, newval)
_InterlockedExchange((long volatile *)val, (long)newval) #define PR_ATOMIC_ADD(ptr, val) (_InterlockedExchangeAdd(ptr, val) + (val))
#define PR_ATOMIC_ADD(ptr, val) \
(_InterlockedExchangeAdd((long volatile *)ptr, (long)val) + (val))
#elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \ #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \
((defined(DARWIN) && \ ((defined(DARWIN) && \

View File

@ -803,7 +803,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce(
if (!_pr_initialized) _PR_ImplicitInitialization(); if (!_pr_initialized) _PR_ImplicitInitialization();
if (!once->initialized) { if (!once->initialized) {
if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { if (PR_AtomicSet(&once->inProgress, 1) == 0) {
once->status = (*func)(); once->status = (*func)();
PR_Lock(mod_init.ml); PR_Lock(mod_init.ml);
once->initialized = 1; once->initialized = 1;
@ -832,7 +832,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg(
if (!_pr_initialized) _PR_ImplicitInitialization(); if (!_pr_initialized) _PR_ImplicitInitialization();
if (!once->initialized) { if (!once->initialized) {
if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { if (PR_AtomicSet(&once->inProgress, 1) == 0) {
once->status = (*func)(arg); once->status = (*func)(arg);
PR_Lock(mod_init.ml); PR_Lock(mod_init.ml);
once->initialized = 1; once->initialized = 1;

View File

@ -148,13 +148,13 @@ static void pt_PostNotifies(PRLock *lock, PRBool unlock)
} }
#if defined(DEBUG) #if defined(DEBUG)
pt_debug.cvars_notified += 1; pt_debug.cvars_notified += 1;
if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) if (0 > PR_AtomicDecrement(&cv->notify_pending))
{ {
pt_debug.delayed_cv_deletes += 1; pt_debug.delayed_cv_deletes += 1;
PR_DestroyCondVar(cv); PR_DestroyCondVar(cv);
} }
#else /* defined(DEBUG) */ #else /* defined(DEBUG) */
if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) if (0 > PR_AtomicDecrement(&cv->notify_pending))
PR_DestroyCondVar(cv); PR_DestroyCondVar(cv);
#endif /* defined(DEBUG) */ #endif /* defined(DEBUG) */
} }
@ -338,7 +338,7 @@ static void pt_PostNotifyToCvar(PRCondVar *cvar, PRBool broadcast)
} }
/* A brand new entry in the array */ /* A brand new entry in the array */
(void)PR_ATOMIC_INCREMENT(&cvar->notify_pending); (void)PR_AtomicIncrement(&cvar->notify_pending);
notified->cv[index].times = (broadcast) ? -1 : 1; notified->cv[index].times = (broadcast) ? -1 : 1;
notified->cv[index].cv = cvar; notified->cv[index].cv = cvar;
notified->length += 1; notified->length += 1;
@ -367,7 +367,7 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(PRLock *lock)
PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar) PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar)
{ {
if (0 > PR_ATOMIC_DECREMENT(&cvar->notify_pending)) if (0 > PR_AtomicDecrement(&cvar->notify_pending))
{ {
PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv); PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv);
#if defined(DEBUG) #if defined(DEBUG)

View File

@ -752,10 +752,10 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred)
if ((NULL != cv) && !thred->interrupt_blocked) if ((NULL != cv) && !thred->interrupt_blocked)
{ {
PRIntn rv; PRIntn rv;
(void)PR_ATOMIC_INCREMENT(&cv->notify_pending); (void)PR_AtomicIncrement(&cv->notify_pending);
rv = pthread_cond_broadcast(&cv->cv); rv = pthread_cond_broadcast(&cv->cv);
PR_ASSERT(0 == rv); PR_ASSERT(0 == rv);
if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) if (0 > PR_AtomicDecrement(&cv->notify_pending))
PR_DestroyCondVar(cv); PR_DestroyCondVar(cv);
} }
return PR_SUCCESS; return PR_SUCCESS;

View File

@ -1165,9 +1165,9 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type,
if (type == PR_SYSTEM_THREAD) if (type == PR_SYSTEM_THREAD)
{ {
thread->flags |= _PR_SYSTEM; thread->flags |= _PR_SYSTEM;
PR_ATOMIC_INCREMENT(&_pr_systemActive); PR_AtomicIncrement(&_pr_systemActive);
} }
else PR_ATOMIC_INCREMENT(&_pr_userActive); else PR_AtomicIncrement(&_pr_userActive);
if (state == PR_JOINABLE_THREAD) { if (state == PR_JOINABLE_THREAD) {
if (!thread->term) if (!thread->term)

View File

@ -137,7 +137,7 @@ PR_IMPLEMENT(PRStatus) PR_NewThreadPrivateIndex(
PR_ASSERT(NULL != newIndex); PR_ASSERT(NULL != newIndex);
PR_ASSERT(NULL != _pr_tpd_destructors); PR_ASSERT(NULL != _pr_tpd_destructors);
index = PR_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1; /* allocate index */ index = PR_AtomicIncrement(&_pr_tpd_highwater) - 1; /* allocate index */
if (_PR_TPD_LIMIT <= index) if (_PR_TPD_LIMIT <= index)
{ {
PR_SetError(PR_TPD_RANGE_ERROR, 0); PR_SetError(PR_TPD_RANGE_ERROR, 0);