AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ASpinlockMutex Class Reference

Synchronization primitive that is implemented with atomic values instead of doing syscalls. More...

#include <AUI/Thread/AMutex.h>

Public Member Functions

void lock ()
 
bool try_lock () noexcept
 Tries to acquire the mutex without blocking.
 
void unlock () noexcept
 

Detailed Description

Synchronization primitive that is implemented with atomic values instead of doing syscalls.

In contrast to a regular mutex, threads will busy-wait (infinitely check for unlocked state) and waste CPU cycles instead of yielding the CPU to another thread with a syscall.

ASpinlockMutex may be faster than a regular mutex in some cases. Use benchmarks to compare.

Member Function Documentation

◆ try_lock()

bool ASpinlockMutex::try_lock ( )
inlinenodiscardnoexcept

Tries to acquire the mutex without blocking.

Returns
true if the mutex is successfully acquired, false otherwise.

The documentation for this class was generated from the following file: