#include "SDL_stdinc.h"
#include "SDL_platform.h"
#include "begin_code.h"
#include "close_code.h"
Go to the source code of this file.
Typedefs | |
typedef volatile Uint32 | SDL_SpinLock |
Functions | |
DECLSPEC void SDLCALL | SDL_AtomicLock (SDL_SpinLock *lock) |
Lock a spin lock by setting it to a none zero value. | |
DECLSPEC void SDLCALL | SDL_AtomicUnlock (SDL_SpinLock *lock) |
Unlock a spin lock by setting it to 0. Always returns immediately. | |
DECLSPEC SDL_bool SDLCALL | SDL_AtomicTestThenSet32 (volatile Uint32 *ptr) |
Check to see if *ptr == 0 and set it to 1. | |
DECLSPEC void SDLCALL | SDL_AtomicClear32 (volatile Uint32 *ptr) |
set the value pointed to by ptr to be zero. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicFetchThenIncrement32 (volatile Uint32 *ptr) |
fetch the current value of *ptr and then increment that value in place. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicFetchThenDecrement32 (volatile Uint32 *ptr) |
fetch *ptr and then decrement the value in place. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicFetchThenAdd32 (volatile Uint32 *ptr, Uint32 value) |
fetch the current value at ptr and then add value to *ptr. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicFetchThenSubtract32 (volatile Uint32 *ptr, Uint32 value) |
Fetch *ptr and then subtract value from it. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicIncrementThenFetch32 (volatile Uint32 *ptr) |
Add one to the data pointed to by ptr and return that value. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicDecrementThenFetch32 (volatile Uint32 *ptr) |
Subtract one from data pointed to by ptr and return the new value. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicAddThenFetch32 (volatile Uint32 *ptr, Uint32 value) |
Add value to the data pointed to by ptr and return result. | |
DECLSPEC Uint32 SDLCALL | SDL_AtomicSubtractThenFetch32 (volatile Uint32 *ptr, Uint32 value) |
Subtract value from the data pointed to by ptr and return the result. | |
DECLSPEC SDL_bool SDLCALL | SDL_AtomicTestThenSet64 (volatile Uint64 *ptr) |
DECLSPEC void SDLCALL | SDL_AtomicClear64 (volatile Uint64 *ptr) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicFetchThenIncrement64 (volatile Uint64 *ptr) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicFetchThenDecrement64 (volatile Uint64 *ptr) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicFetchThenAdd64 (volatile Uint64 *ptr, Uint64 value) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicFetchThenSubtract64 (volatile Uint64 *ptr, Uint64 value) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicIncrementThenFetch64 (volatile Uint64 *ptr) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicDecrementThenFetch64 (volatile Uint64 *ptr) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicAddThenFetch64 (volatile Uint64 *ptr, Uint64 value) |
DECLSPEC Uint64 SDLCALL | SDL_AtomicSubtractThenFetch64 (volatile Uint64 *ptr, Uint64 value) |
typedef volatile Uint32 SDL_SpinLock |
These operations may, or may not, actually be implemented using processor specific atomic operations. When possible they are implemented as true processor specific atomic operations. When that is not possible the are implemented using locks that *do* use the available atomic operations.
At the very minimum spin locks must be implemented. Without spin locks it is not possible (AFAICT) to emulate the rest of the atomic operations. SDL AtomicLock.
The spin lock functions and type are required and can not be emulated because they are used in the emulation code.
Add value to the data pointed to by ptr and return result.
ptr | The address of the data to be modified. | |
value | The value to be added. |
void SDL_AtomicClear32 | ( | volatile Uint32 * | ptr | ) |
set the value pointed to by ptr to be zero.
ptr | address of the value to be set to zero |
Subtract one from data pointed to by ptr and return the new value.
ptr | The address of the data to decrement. |
fetch the current value at ptr and then add value to *ptr.
ptr | the address of data we are changing. | |
value | the value to add to *ptr. |
fetch *ptr and then decrement the value in place.
ptr | address of the value to fetch and drement |
fetch the current value of *ptr and then increment that value in place.
ptr | address of the value to fetch and increment |
Fetch *ptr and then subtract value from it.
ptr | the address of the data being changed. | |
value | the value to subtract from *ptr. |
Add one to the data pointed to by ptr and return that value.
ptr | address of the data to increment. |
void SDL_AtomicLock | ( | SDL_SpinLock * | lock | ) |
Lock a spin lock by setting it to a none zero value.
lock | points to the lock. |
Subtract value from the data pointed to by ptr and return the result.
ptr | The address of the data to be modified. | |
value | The value to be subtracted. |
SDL_bool SDL_AtomicTestThenSet32 | ( | volatile Uint32 * | ptr | ) |
Check to see if *ptr == 0 and set it to 1.
ptr | points to the value to be tested and set. |
void SDL_AtomicUnlock | ( | SDL_SpinLock * | lock | ) |
Unlock a spin lock by setting it to 0. Always returns immediately.
lock | points to the lock. |