Wiki Page Content

Differences between revisions 8 and 9
Revision 8 as of 2011-02-02 18:15:42
Size: 622
Editor: SheenaSmith
Comment: update content - w/ Sam; remove draft
Revision 9 as of 2011-02-02 18:17:16
Size: 617
Editor: SheenaSmith
Comment: modify include
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
<<Include(CategoryAtomic, , , from="Start include here.", to="##The Include ends here")>> <<Include(CategoryAtomic, , , from="Start Include here.", to="##End Include here")>>

SDL_AtomicLock

Use this function to lock a spin lock by setting it to a non-zero value.

Syntax

void SDL_AtomicLock(SDL_SpinLock* lock)

Function Parameters

lock

a pointer to a lock variable

Code Examples

You can add your code example here

Remarks

The atomic locks are efficient spinlocks using CPU instructions, but are vulnerable to starvation and can spin forever if a thread holding a lock has been terminated. For this reason you should minimize the code executed inside an atomic lock and never do expensive things like API or system calls while holding them.

/!\ The atomic locks are not safe to lock recursively.


CategoryAPI, CategoryAtomic

None: SDL_AtomicLock (last edited 2011-02-02 18:18:28 by SheenaSmith)

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