SpinLock Reference

File
XSFoundation/include/XS/Functions/SpinLock.h
Author
Jean-David Gadina - www.xs-labs.com
Copyright
© (c) 2020 - Jean-David Gadina - www.xs-labs.com
Date
Sunday, September 27, 2020

Overview

Spin lock functions

Tasks

XSSpinLockLock

Locks a spin lock, spinning if the lock is already held

XS_EXPORT void XSSpinLockLock( XSSpinLock *lock );

Parameters
  • lock
    The spin lock to lock

XSSpinLockTryLock

Tries to lock a spin lock

XS_EXPORT bool XSSpinLockTryLock( XSSpinLock *lock );

Discussion

This function does not spin and returns immediately if the lock is already held.

Parameters
  • lock
    The spin lock to unlock
Return value

True if the spin lock was successfully locked, otherwise false

XSSpinLockUnlock

Unconditionally unlocks a spin lock

XS_EXPORT void XSSpinLockUnlock( XSSpinLock *lock );

Parameters
  • lock
    The spin lock to unlock