Locks a AudioStream.
|
constexpr | AudioStreamLock ()=default |
| Creates an empty lock.
|
|
constexpr | AudioStreamLock (AudioStreamLock &&other) |
| Move ctor.
|
|
| AudioStreamLock (AudioStreamBase &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= (const LockBase &other)=delete |
|
LockBase & | operator= (LockBase &&other) |
| Move assignment.
|
|
AudioStreamRef | release () |
| Release locked resource without unlocking it.
|
|
|
constexpr | LockBase (AudioStreamRef &&resource) |
| Constructs initializing member.
|
|
◆ AudioStreamLock()
Each AudioStreamBase 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 MutexBase.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: