OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_CriticalSection.h>
Public Member Functions | |
CriticalSection () noexcept | |
~CriticalSection () noexcept | |
void | enter () const noexcept |
bool | tryEnter () const noexcept |
void | exit () const noexcept |
A re-entrant mutex.
A CriticalSection acts as a re-entrant mutex object. The best way to lock and unlock one of these is by using RAII in the form of a local ScopedLock object - have a look through the codebase for many examples of how to do this.
In almost all cases you'll want to declare your CriticalSection as a member variable. Occasionally you may want to declare one as a static variable, but in that case the usual C++ static object order-of-construction warnings should be heeded.
Definition at line 42 of file juce_CriticalSection.h.
Provides the type of scoped lock to use with a CriticalSection.
Definition at line 93 of file juce_CriticalSection.h.
Provides the type of scoped try-locker to use with a CriticalSection.
Definition at line 99 of file juce_CriticalSection.h.
Provides the type of scoped unlocker to use with a CriticalSection.
Definition at line 96 of file juce_CriticalSection.h.
|
noexcept |
Creates a CriticalSection object.
|
noexcept |
Destructor. If the critical section is deleted whilst locked, any subsequent behaviour is unpredictable.
|
noexcept |
Acquires the lock.
If the lock is already held by the caller thread, the method returns immediately. If the lock is currently held by another thread, this will wait until it becomes free.
It's strongly recommended that you never call this method directly - instead use the ScopedLock class to manage the locking using an RAII pattern instead.
|
noexcept |
|
noexcept |
Attempts to lock this critical section without blocking.
This method behaves identically to CriticalSection::enter, except that the caller thread does not wait if the lock is currently held by another thread but returns false immediately.