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

Semi-safe reference for Mutex.

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

Public Member Functions

 MutexRef (MutexParam resource) noexcept
 Constructs from MutexParam. More...
 
 MutexRef (MutexRaw resource) noexcept
 Constructs from MutexParam. More...
 
 MutexRef (const MutexRef &other) noexcept
 Copy constructor.
 
 ~MutexRef ()
 Destructor.
 
constexpr Mutex (std::nullptr_t) noexcept
 Default ctor.
 
constexpr Mutex (const MutexRaw resource) noexcept
 Constructs from MutexParam. More...
 
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. More...
 
- Public Member Functions inherited from SDL::Mutex
constexpr Mutex (std::nullptr_t) noexcept
 Default ctor.
 
constexpr Mutex (const MutexRaw resource) noexcept
 Constructs from MutexParam. More...
 
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. More...
 
 ~Mutex ()
 Destructor.
 
constexpr Mutexoperator= (Mutex &&other) noexcept
 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.
 
constexpr operator MutexParam () const noexcept
 Converts to MutexParam.
 
void Destroy ()
 Destroy a mutex created with Mutex.Mutex(). More...
 
void Lock ()
 Lock the mutex. More...
 
void TryLock ()
 Try to lock a mutex without blocking. More...
 
void Unlock ()
 Unlock the mutex. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SDL::Mutex
constexpr Mutexoperator= (const Mutex &other) noexcept=default
 Assignment operator.
 

Constructor & Destructor Documentation

◆ MutexRef() [1/2]

SDL::MutexRef::MutexRef ( MutexParam  resource)
inlinenoexcept
Parameters
resourcea MutexRaw or Mutex.

This does not takes ownership!

◆ MutexRef() [2/2]

SDL::MutexRef::MutexRef ( MutexRaw  resource)
inlinenoexcept
Parameters
resourcea MutexRaw or Mutex.

This does not takes ownership!

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.
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 ( const 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: