SDL3pp
A slim C++ wrapper for SDL3
|
Handle to a non owned mutex. More...
Public Member Functions | |
constexpr | MutexRef (const MutexRef &other) |
Copy constructor. | |
constexpr | MutexRef (MutexRef &&other) |
Move constructor. | |
constexpr | ~MutexRef ()=default |
Default constructor. | |
MutexRef & | operator= (MutexRef other) |
Assignment operator. | |
void | reset (SDL_Mutex *newResource={}) |
Destroy a mutex created with MutexBase.MutexBase(). | |
MutexBase () | |
Create a new mutex. | |
![]() | |
MutexBase () | |
Create a new mutex. | |
void | Lock () |
Lock the mutex. | |
void | TryLock () |
Try to lock a mutex without blocking. | |
void | Unlock () |
Unlock the mutex. | |
constexpr | Resource (T resource={}) |
Constructs the underlying resource. | |
constexpr | Resource (std::nullptr_t) |
Equivalent to default ctor. | |
constexpr | Resource (std::nullopt_t) |
Equivalent to default ctor. | |
Resource (const Resource &other)=delete | |
Resource (Resource &&other)=delete | |
![]() | |
constexpr | Resource (SDL_Mutex * resource={}) |
Constructs the underlying resource. | |
constexpr | Resource (std::nullptr_t) |
Equivalent to default ctor. | |
constexpr | Resource (std::nullopt_t) |
Equivalent to default ctor. | |
Resource (const Resource &other)=delete | |
Resource (Resource &&other)=delete | |
Resource & | operator= (const Resource &other)=delete |
Resource & | operator= (Resource &&other)=delete |
constexpr | operator bool () const |
True if contains a valid resource. | |
constexpr bool | operator== (const Resource &other) const=default |
Comparison. | |
constexpr bool | operator== (std::nullopt_t) const |
Comparison. | |
constexpr bool | operator== (std::nullptr_t) const |
Comparison. | |
constexpr SDL_Mutex * | get () const |
Return contained resource;. | |
constexpr SDL_Mutex * | release (SDL_Mutex * newResource={}) |
Return contained resource and empties or replace value. | |
constexpr const SDL_Mutex * | operator-> () const |
Access to fields. | |
constexpr SDL_Mutex * | operator-> () |
Access to fields. | |
|
inline |
All newly-created mutexes begin in the unlocked state.
Calls to MutexBase.Lock() will not return while the mutex is locked by another thread. See MutexBase.TryLock() to attempt to lock without blocking.
SDL mutexes are reentrant.
|
inline |
This function must be called on any mutex that is no longer needed. Failure to destroy a mutex will result in a system memory or resource leak. While it is safe to destroy a mutex that is unlocked, it is not safe to attempt to destroy a locked mutex, and may result in undefined behavior depending on the platform.