# CategoryAtomic

Atomic operations.

IMPORTANT: If you are not an expert in concurrent lockless programming, you
should not be using any functions in this file. You should be protecting
your data structures with full mutexes instead.

***Seriously, here be dragons!***

You can find out a little more about lockless programming and the subtle
issues that can arise here:
https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming

There's also lots of good information here:

- https://www.1024cores.net/home/lock-free-algorithms
- https://preshing.com/

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.

All of the atomic operations that modify memory are full memory barriers.

<!-- END CATEGORY DOCUMENTATION -->

## Functions

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryAtomic, CategoryAPIFunction -->
- [SDL_AddAtomicInt](SDL_AddAtomicInt)
- [SDL_CompareAndSwapAtomicInt](SDL_CompareAndSwapAtomicInt)
- [SDL_CompareAndSwapAtomicPointer](SDL_CompareAndSwapAtomicPointer)
- [SDL_CompareAndSwapAtomicU32](SDL_CompareAndSwapAtomicU32)
- [SDL_GetAtomicInt](SDL_GetAtomicInt)
- [SDL_GetAtomicPointer](SDL_GetAtomicPointer)
- [SDL_GetAtomicU32](SDL_GetAtomicU32)
- [SDL_LockSpinlock](SDL_LockSpinlock)
- [SDL_MemoryBarrierAcquireFunction](SDL_MemoryBarrierAcquireFunction)
- [SDL_MemoryBarrierReleaseFunction](SDL_MemoryBarrierReleaseFunction)
- [SDL_SetAtomicInt](SDL_SetAtomicInt)
- [SDL_SetAtomicPointer](SDL_SetAtomicPointer)
- [SDL_SetAtomicU32](SDL_SetAtomicU32)
- [SDL_TryLockSpinlock](SDL_TryLockSpinlock)
- [SDL_UnlockSpinlock](SDL_UnlockSpinlock)
<!-- END CATEGORY LIST -->

## Datatypes

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryAtomic, CategoryAPIDatatype -->
- [SDL_SpinLock](SDL_SpinLock)
<!-- END CATEGORY LIST -->

## Structs

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryAtomic, CategoryAPIStruct -->
- [SDL_AtomicInt](SDL_AtomicInt)
- [SDL_AtomicU32](SDL_AtomicU32)
<!-- END CATEGORY LIST -->

## Enums

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryAtomic, CategoryAPIEnum -->
- (none.)
<!-- END CATEGORY LIST -->

## Macros

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryAtomic, CategoryAPIMacro -->
- [SDL_AtomicDecRef](SDL_AtomicDecRef)
- [SDL_AtomicIncRef](SDL_AtomicIncRef)
- [SDL_CompilerBarrier](SDL_CompilerBarrier)
- [SDL_CPUPauseInstruction](SDL_CPUPauseInstruction)
- [SDL_MemoryBarrierAcquire](SDL_MemoryBarrierAcquire)
- [SDL_MemoryBarrierRelease](SDL_MemoryBarrierRelease)
<!-- END CATEGORY LIST -->


----
[CategoryAPICategory](CategoryAPICategory)