Wiki Page Content

Revision 9 as of 2011-01-28 20:03:53

Clear message

DRAFT

Atomic Operations for 32 and 64 Bit Values

Include File(s): SDL_atomic.h

Introduction

This category contains functions for handling atomic operations in both 32-bit and 64-bit platforms. green

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. green

green

/!\ IMPORTANT:

  • If you are not an expert in concurrent lockless programming, you should only be using the atomic lock and reference counting functions in this file. In all other cases you should be protecting your data structures with full mutexes.

The list of "safe" functions to use are:

Seriously, here be dragons!

You can find out a little more about lockless programming and the subtle issues that can arise here:

There's also lots of good information here:

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. green

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

Functions


CategoryCategory

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit