zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_spinlock.c File Reference
#include "SDL_config.h"
#include "SDL_atomic.h"
#include "SDL_mutex.h"
#include "SDL_timer.h"

Go to the source code of this file.

Functions

void SDL_AtomicLock (SDL_SpinLock *lock)
 Lock a spin lock by setting it to a non-zero value. More...
 
SDL_bool SDL_AtomicTryLock (SDL_SpinLock *lock)
 Try to lock a spin lock by setting it to a non-zero value. More...
 
void SDL_AtomicUnlock (SDL_SpinLock *lock)
 Unlock a spin lock by setting it to 0. Always returns immediately. More...
 

Function Documentation

void SDL_AtomicLock ( SDL_SpinLock lock)

Lock a spin lock by setting it to a non-zero value.

Parameters
lockPoints to the lock.

Definition at line 100 of file SDL_spinlock.c.

References SDL_AtomicTryLock(), and SDL_Delay().

Referenced by enterLock(), SDL_AddTimer(), SDL_Generic_GetTLSData(), SDL_GetErrBuf(), SDL_ReportAssertion(), SDL_SYS_GetTLSData(), and SDL_TimerThread().

SDL_bool SDL_AtomicTryLock ( SDL_SpinLock lock)

Try to lock a spin lock by setting it to a non-zero value.

Parameters
lockPoints to the lock.
Returns
SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.

Definition at line 34 of file SDL_spinlock.c.

References SDL_COMPILE_TIME_ASSERT, SDL_CreateMutex(), SDL_FALSE, SDL_LockMutex(), SDL_TRUE, and SDL_UnlockMutex().

Referenced by SDL_AtomicLock().

void SDL_AtomicUnlock ( SDL_SpinLock lock)

Unlock a spin lock by setting it to 0. Always returns immediately.

Parameters
lockPoints to the lock.

Definition at line 109 of file SDL_spinlock.c.

Referenced by leaveLock(), SDL_AddTimer(), SDL_Generic_GetTLSData(), SDL_GetErrBuf(), SDL_ReportAssertion(), SDL_SYS_GetTLSData(), and SDL_TimerThread().