SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::MutexRef Struct Reference

Reference for Mutex. More...

Inheritance diagram for SDL::MutexRef:
Inheritance graph
[legend]
Collaboration diagram for SDL::MutexRef:
Collaboration graph
[legend]

Public Member Functions

constexpr MutexRef (MutexRaw resource) noexcept
 Constructs from raw Mutex. More...
 
constexpr MutexRef (const Mutex &resource) noexcept
 Constructs from Mutex. More...
 
constexpr MutexRef (Mutex &&resource) noexcept
 Constructs from Mutex. More...
 
constexpr MutexRef (const MutexRef &other) noexcept
 Copy constructor.
 
constexpr MutexRef (MutexRef &&other) noexcept
 Move constructor.
 
 ~MutexRef ()
 Destructor.
 
MutexRefoperator= (const MutexRef &other) noexcept
 Assignment operator.
 
constexpr operator MutexRaw () const noexcept
 Converts to MutexRaw.
 
constexpr Mutex (std::nullptr_t) noexcept
 Default ctor.
 
constexpr Mutex (MutexRaw resource) noexcept
 Constructs from raw Mutex. More...
 
constexpr Mutex (const Mutex &other) noexcept=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. More...
 
- Public Member Functions inherited from SDL::Mutex
constexpr Mutex (std::nullptr_t) noexcept
 Default ctor.
 
constexpr Mutex (MutexRaw resource) noexcept
 Constructs from raw Mutex. More...
 
constexpr Mutex (const Mutex &other) noexcept=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. More...
 
 ~Mutex ()
 Destructor.
 
constexpr Mutexoperator= (Mutex &&other) noexcept
 Assignment operator.
 
Mutexoperator= (const Mutex &other)=delete
 Assignment operator.
 
constexpr MutexRaw get () const noexcept
 Retrieves underlying MutexRaw.
 
constexpr MutexRaw release () noexcept
 Retrieves underlying MutexRaw and clear this.
 
constexpr auto operator<=> (const Mutex &other) const noexcept=default
 Comparison.
 
constexpr operator bool () const noexcept
 Converts to bool.
 
void Destroy ()
 Destroy a mutex created with CreateMutex(). More...
 
void Lock ()
 Lock the mutex. More...
 
bool TryLock ()
 Try to lock a mutex without blocking. More...
 
void Unlock ()
 Unlock the mutex. More...
 

Detailed Description

This does not take ownership!

Constructor & Destructor Documentation

◆ MutexRef() [1/3]

constexpr SDL::MutexRef::MutexRef ( MutexRaw  resource)
inlineconstexprnoexcept
Parameters
resourcea MutexRaw.

This does not takes ownership!

◆ MutexRef() [2/3]

constexpr SDL::MutexRef::MutexRef ( const Mutex resource)
inlineconstexprnoexcept
Parameters
resourcea Mutex.

This does not takes ownership!

◆ MutexRef() [3/3]

constexpr SDL::MutexRef::MutexRef ( Mutex &&  resource)
inlineconstexprnoexcept
Parameters
resourcea Mutex.

This will release the ownership from resource!

Member Function Documentation

◆ Mutex() [1/2]

SDL::Mutex::Mutex ( )
inline

All newly-created mutexes begin in the unlocked state.

Calls to Mutex.Lock() will not return while the mutex is locked by another thread. See Mutex.TryLock() to attempt to lock without blocking.

SDL mutexes are reentrant.

Postcondition
the initialized and unlocked mutex or nullptr on failure; call GetError() for more information.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Mutex.Destroy
Mutex.Lock
Mutex.TryLock
Mutex.Unlock

◆ Mutex() [2/2]

constexpr SDL::Mutex::Mutex ( MutexRaw  resource)
inlineexplicitconstexprnoexcept
Parameters
resourcea MutexRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.


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