Locks a AudioStream.
|
constexpr | AudioStreamLock ()=default |
| Creates an empty lock.
|
|
constexpr | AudioStreamLock (AudioStreamLock &&other) |
| Move ctor.
|
|
| AudioStreamLock (AudioStreamRef stream) |
| Lock an audio stream for serialized access.
|
|
| ~AudioStreamLock () |
| Destructor.
|
|
void | Unlock () |
| Unlock an audio stream for serialized access.
|
|
void | reset () |
| Same as Unlock(), just for uniformity.
|
|
constexpr | LockBase ()=default |
| Default ctor.
|
|
| LockBase (const LockBase &other)=delete |
|
| LockBase (LockBase &&other) |
| Move ctor.
|
|
constexpr | ~LockBase () |
| Dtor.
|
|
LockBase & | operator= (LockBase other) |
| Move assignment.
|
|
RESOURCE | release () |
| Returns reference and reset this.
|
|
constexpr | operator bool () const |
| Check if not null.
|
|
constexpr bool | operator== (const ResourcePtrBase &other) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullptr_t) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullopt_t) const |
| Comparison.
|
|
constexpr reference | operator* () const |
| Gets reference.
|
|
constexpr const reference * | operator-> () const |
| Gets addressable reference.
|
|
constexpr reference * | operator-> () |
| Gets addressable reference.
|
|
reference | get () const |
| Get reference.
|
|
|
using | deleter = DELETER |
| The deleter type.
|
|
using | reference = RESOURCE |
| The reference resource type.
|
|
using | value_type = typename reference::value_type |
| The raw resource type.
|
|
constexpr | LockBase (AudioStreamRef &&resource) |
| Constructs initializing member.
|
|
constexpr | ResourceOwnerBase (base::value_type value={}, DELETER deleter={}) |
| Constructs from raw type.
|
|
void | free () |
| Frees resource.
|
|
constexpr | ResourcePtrBase (value_type value={}) |
| Constructs from raw type.
|
|
reference & | get () |
| Get reference.
|
|
◆ AudioStreamLock()
Each AudioStream has an internal mutex it uses to protect its data structures from threading conflicts. This function allows an app to lock that mutex, which could be useful if registering callbacks on this stream.
One does not need to lock a stream to use in it most cases, as the stream manages this lock internally. However, this lock is held during callbacks, which may run from arbitrary threads at any time, so if an app needs to protect shared data during those callbacks, locking the stream guarantees that the callback is not running while the lock is held.
As this is just a wrapper over MutexRef.Lock for an internal lock; it has all the same attributes (recursive locks are allowed, etc).
- Parameters
-
stream | the audio stream to lock. |
- Exceptions
-
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- AudioStreamLock.Unlock
◆ Unlock()
void SDL::AudioStreamLock::Unlock |
( |
| ) |
|
|
inline |
The documentation for this struct was generated from the following file: