src/atomic/SDL_atomic.c
changeset 5095 dceec93471e7
parent 5004 0c72ae7b7cb2
child 5262 b530ef003506
     1.1 --- a/src/atomic/SDL_atomic.c	Mon Jan 24 23:54:21 2011 -0600
     1.2 +++ b/src/atomic/SDL_atomic.c	Tue Jan 25 17:40:06 2011 -0800
     1.3 @@ -70,61 +70,8 @@
     1.4      SDL_AtomicUnlock(&locks[index]);
     1.5  }
     1.6  
     1.7 -#undef SDL_AtomicSet
     1.8 -int
     1.9 -SDL_AtomicSet(SDL_atomic_t *a, int value)
    1.10 -{
    1.11 -    int oldvalue;
    1.12 -
    1.13 -    enterLock(a);
    1.14 -    oldvalue = a->value;
    1.15 -    a->value = value;
    1.16 -    leaveLock(a);
    1.17 -
    1.18 -    return oldvalue;
    1.19 -}
    1.20 -
    1.21 -#undef SDL_AtomicGet
    1.22 -int
    1.23 -SDL_AtomicGet(SDL_atomic_t *a)
    1.24 -{
    1.25 -    /* Assuming integral reads on this platform, we're safe here since the
    1.26 -       functions that set the variable have the necessary memory barriers.
    1.27 -    */
    1.28 -    return a->value;
    1.29 -}
    1.30 -
    1.31 -#undef SDL_AtomicAdd
    1.32 -int
    1.33 -SDL_AtomicAdd(SDL_atomic_t *a, int value)
    1.34 -{
    1.35 -    int oldvalue;
    1.36 -
    1.37 -    enterLock(a);
    1.38 -    oldvalue = a->value;
    1.39 -    a->value += value;
    1.40 -    leaveLock(a);
    1.41 -
    1.42 -    return oldvalue;
    1.43 -}
    1.44 -
    1.45 -#undef SDL_AtomicIncRef
    1.46 -void
    1.47 -SDL_AtomicIncRef(SDL_atomic_t *a)
    1.48 -{
    1.49 -    SDL_AtomicAdd(a, 1);
    1.50 -}
    1.51 -
    1.52 -#undef SDL_AtomicDecRef
    1.53  SDL_bool
    1.54 -SDL_AtomicDecRef(SDL_atomic_t *a)
    1.55 -{
    1.56 -    return SDL_AtomicAdd(a, -1) == 1;
    1.57 -}
    1.58 -
    1.59 -#undef SDL_AtomicCAS
    1.60 -SDL_bool
    1.61 -SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
    1.62 +SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
    1.63  {
    1.64      SDL_bool retval = SDL_FALSE;
    1.65  
    1.66 @@ -138,28 +85,8 @@
    1.67      return retval;
    1.68  }
    1.69  
    1.70 -#undef SDL_AtomicSetPtr
    1.71 -void
    1.72 -SDL_AtomicSetPtr(void** a, void* value)
    1.73 -{
    1.74 -    void *prevval;
    1.75 -    do {
    1.76 -        prevval = *a;
    1.77 -    } while (!SDL_AtomicCASPtr(a, prevval, value));
    1.78 -}
    1.79 -
    1.80 -#undef SDL_AtomicGetPtr
    1.81 -void*
    1.82 -SDL_AtomicGetPtr(void** a)
    1.83 -{
    1.84 -    /* Assuming integral reads on this platform, we're safe here since the
    1.85 -       functions that set the pointer have the necessary memory barriers.
    1.86 -    */
    1.87 -    return *a;
    1.88 -}
    1.89 -
    1.90 -#undef SDL_AtomicCASPtr
    1.91 -SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
    1.92 +SDL_bool
    1.93 +SDL_AtomicCASPtr_(void **a, void *oldval, void *newval)
    1.94  {
    1.95      SDL_bool retval = SDL_FALSE;
    1.96