Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Put the real SDL_AtomicCAS() and SDL_AtomicCASPtr() symbols into the …
Browse files Browse the repository at this point in the history
…library.
  • Loading branch information
slouken committed Mar 8, 2013
1 parent 9a1385b commit 62ca1a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 2 additions & 4 deletions include/SDL_atomic.h
Expand Up @@ -196,9 +196,8 @@ typedef struct { int value; } SDL_atomic_t;
* \note If you don't know what this function is for, you shouldn't use it!
*/
#ifndef SDL_AtomicCAS
#define SDL_AtomicCAS SDL_AtomicCAS_
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
#endif
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval);

/**
* \brief Set an atomic variable to a value.
Expand Down Expand Up @@ -271,9 +270,8 @@ static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
* \note If you don't know what this function is for, you shouldn't use it!
*/
#ifndef SDL_AtomicCASPtr
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval);
#endif
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void *newval);

/**
* \brief Set a pointer to a value atomically.
Expand Down
10 changes: 6 additions & 4 deletions src/atomic/SDL_atomic.c
Expand Up @@ -27,6 +27,8 @@
doesn't have that compiler. That way we always have a working set of
atomic operations built into the library.
*/
#undef SDL_AtomicCAS
#undef SDL_AtomicCASPtr

/*
If any of the operations are not provided then we must emulate some
Expand Down Expand Up @@ -69,8 +71,8 @@ leaveLock(void *a)
SDL_AtomicUnlock(&locks[index]);
}

SDL_bool
SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
DECLSPEC SDL_bool SDLCALL
SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval)
{
SDL_bool retval = SDL_FALSE;

Expand All @@ -84,8 +86,8 @@ SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
return retval;
}

SDL_bool
SDL_AtomicCASPtr_(void **a, void *oldval, void *newval)
DECLSPEC SDL_bool SDLCALL
SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
{
SDL_bool retval = SDL_FALSE;

Expand Down

0 comments on commit 62ca1a4

Please sign in to comment.