#[repr(transparent)]pub struct SDL_SpinLock(pub c_int);Expand description
An atomic spinlock.
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.
They are also vulnerable to starvation if the thread holding the lock is lower priority than other threads and doesn’t get scheduled. In general you should use mutexes instead, since they have better performance and contention behavior.
The atomic locks are not safe to lock recursively.
Porting Note: The spin lock functions and type are required and can not be emulated because they are used in the atomic emulation code.
Tuple Fields§
§0: c_intTrait Implementations§
Source§impl Debug for SDL_SpinLock
impl Debug for SDL_SpinLock
Source§impl Default for SDL_SpinLock
impl Default for SDL_SpinLock
Source§fn default() -> SDL_SpinLock
fn default() -> SDL_SpinLock
Source§impl GroupMetadata for SDL_SpinLock
Available on crate feature metadata only.
impl GroupMetadata for SDL_SpinLock
metadata only.