Commit d295d98d authored by Brad Lassey's avatar Brad Lassey
Browse files

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

(transplanted from 8bc975526c0fb0912701477a79f0b94789dce9c2)

--HG--
extra : transplant_source : %8B%C9uRl%0F%B0%91%27%01Gzy%F0%B9G%89%DC%E9%C2
parent 3bb0c28e
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -125,12 +125,10 @@ long __cdecl _InterlockedExchange(long volatile *Target, long Value);
long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value);
#pragma intrinsic(_InterlockedExchangeAdd)

#define PR_ATOMIC_INCREMENT(val)   _InterlockedIncrement((long volatile *)val)
#define PR_ATOMIC_DECREMENT(val)   _InterlockedDecrement((long volatile *)val)
#define PR_ATOMIC_SET(val, newval) \
        _InterlockedExchange((long volatile *)val, (long)newval)
#define PR_ATOMIC_ADD(ptr, val)    \
        (_InterlockedExchangeAdd((long volatile *)ptr, (long)val) + (val))
#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement(val)
#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement(val)
#define PR_ATOMIC_SET(val, newval) _InterlockedExchange(val, newval)
#define PR_ATOMIC_ADD(ptr, val) (_InterlockedExchangeAdd(ptr, val) + (val))

#elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \
      ((defined(DARWIN) && \
+2 −2
Original line number Diff line number Diff line
@@ -803,7 +803,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce(
    if (!_pr_initialized) _PR_ImplicitInitialization();

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

    if (!once->initialized) {
	if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) {
	if (PR_AtomicSet(&once->inProgress, 1) == 0) {
	    once->status = (*func)(arg);
	    PR_Lock(mod_init.ml);
	    once->initialized = 1;
+4 −4
Original line number Diff line number Diff line
@@ -148,13 +148,13 @@ static void pt_PostNotifies(PRLock *lock, PRBool unlock)
            }
#if defined(DEBUG)
            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;
                PR_DestroyCondVar(cv);
            }
#else  /* defined(DEBUG) */
            if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
            if (0 > PR_AtomicDecrement(&cv->notify_pending))
                PR_DestroyCondVar(cv);
#endif  /* defined(DEBUG) */
        }
@@ -338,7 +338,7 @@ static void pt_PostNotifyToCvar(PRCondVar *cvar, PRBool broadcast)
    }

    /* 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].cv = cvar;
    notified->length += 1;
@@ -367,7 +367,7 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(PRLock *lock)

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);
#if defined(DEBUG)
+2 −2
Original line number Diff line number Diff line
@@ -752,10 +752,10 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred)
    if ((NULL != cv) && !thred->interrupt_blocked)
    {
        PRIntn rv;
        (void)PR_ATOMIC_INCREMENT(&cv->notify_pending);
        (void)PR_AtomicIncrement(&cv->notify_pending);
        rv = pthread_cond_broadcast(&cv->cv);
        PR_ASSERT(0 == rv);
        if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending))
        if (0 > PR_AtomicDecrement(&cv->notify_pending))
            PR_DestroyCondVar(cv);
    }
    return PR_SUCCESS;
+2 −2
Original line number Diff line number Diff line
@@ -1165,9 +1165,9 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type,
            if (type == PR_SYSTEM_THREAD)
            {
                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 (!thread->term) 
Loading