|
SDL3pp
A slim C++ wrapper for SDL3
|
A means to serialize access to a resource between threads. More...
Public Member Functions | |
| constexpr | Mutex (MutexRaw resource) noexcept |
| Constructs from raw Mutex. | |
| constexpr | Mutex (const Mutex &other)=delete |
| Copy constructor. | |
| constexpr | Mutex (Mutex &&other) noexcept |
| Move constructor. | |
| constexpr | Mutex (const MutexRef &other)=delete |
| constexpr | Mutex (MutexRef &&other)=delete |
| Mutex () | |
| Create a new mutex. | |
| ~Mutex () | |
| Destructor. | |
| constexpr Mutex & | operator= (Mutex &&other) noexcept |
| Assignment operator. | |
| Mutex & | operator= (const Mutex &other)=delete |
| Assignment operator. | |
| void | Destroy () |
| Destroy a mutex created with CreateMutex(). | |
| void | Lock () |
| Lock the mutex. | |
| bool | TryLock () |
| Try to lock a mutex without blocking. | |
| void | Unlock () |
| Unlock the mutex. | |
| constexpr | ResourceBase (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | ResourceBase (std::nullptr_t=nullptr) |
| Constructs null/invalid. | |
| Public Member Functions inherited from SDL::ResourceBase< MutexRaw > | |
| constexpr | ResourceBase (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | operator bool () const |
| Converts to bool. | |
| constexpr auto | operator<=> (const ResourceBase &other) const=default |
| Comparison. | |
| constexpr RawConstPointer | operator-> () const noexcept |
| member access to underlying resource pointer. | |
| constexpr RawPointer | get () const noexcept |
| Retrieves underlying resource pointer. | |
| constexpr RawPointer | release () noexcept |
| Retrieves underlying resource pointer and clear this. | |
Additional Inherited Members | |
| Public Types inherited from SDL::ResourceBase< MutexRaw > | |
| using | RawPointer |
| The underlying raw pointer type. | |
| using | RawConstPointer |
| The underlying const raw pointer type. | |
A means to serialize access to a resource between threads.
Mutexes (short for "mutual exclusion") are a synchronization primitive that allows exactly one thread to proceed at a time.
Wikipedia has a thorough explanation of the concept:
https://en.wikipedia.org/wiki/Mutex
|
inlineexplicitconstexprnoexcept |