OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_MessageManager.h>
Classes | |
class | Lock |
class | MessageBase |
Public Member Functions | |
void | runDispatchLoop () |
void | stopDispatchLoop () |
bool | hasStopMessageBeenSent () const noexcept |
void * | callFunctionOnMessageThread (MessageCallbackFunction *callback, void *userData) |
bool | isThisTheMessageThread () const noexcept |
void | setCurrentThreadAsMessageThread () |
Thread::ThreadID | getCurrentMessageThread () const noexcept |
bool | currentThreadHasLockedMessageManager () const noexcept |
void | registerBroadcastListener (ActionListener *listener) |
void | deregisterBroadcastListener (ActionListener *listener) |
void | deliverBroadcastMessage (const String &) |
Static Public Member Functions | |
static MessageManager * | getInstance () |
static MessageManager * | getInstanceWithoutCreating () noexcept |
static void | deleteInstance () |
static bool | callAsync (std::function< void()> functionToCall) |
static bool | existsAndIsLockedByCurrentThread () noexcept |
static bool | existsAndIsCurrentThread () noexcept |
static void | broadcastMessage (const String &messageText) |
This class is in charge of the application's event-dispatch loop.
Definition at line 49 of file juce_MessageManager.h.
|
noexcept |
Definition at line 33 of file juce_MessageManager.cpp.
Sends a message to all other JUCE applications that are running.
messageText | the string that will be passed to the actionListenerCallback() method of the broadcast listeners in the other app. |
Asynchronously invokes a function or C++11 lambda on the message thread.
Definition at line 187 of file juce_MessageManager.cpp.
void * juce::MessageManager::callFunctionOnMessageThread | ( | MessageCallbackFunction * | callback, |
void * | userData | ||
) |
Calls a function using the message-thread.
This can be used by any thread to cause this function to be called-back by the message thread. If it's the message-thread that's calling this method, then the function will just be called; if another thread is calling, a message will be posted to the queue, and this method will block until that message is delivered, the function is called, and the result is returned.
Be careful not to cause any deadlocks with this! It's easy to do - e.g. if the caller thread has a critical section locked, which an unrelated message callback then tries to lock before the message thread gets round to processing this callback.
callback | the function to call - its signature must be Definition juce_Array.h:56 |
userData | a user-defined pointer that will be passed to the function that gets called |
Definition at line 167 of file juce_MessageManager.cpp.
|
noexcept |
Returns true if the caller thread has currently got the message manager locked.
see the MessageManagerLock class for more info about this.
This will be true if the caller is the message thread, because that automatically gains a lock while a message is being dispatched.
Definition at line 240 of file juce_MessageManager.cpp.
Referenced by callFunctionOnMessageThread().
|
static |
Deletes the global MessageManager instance. Does nothing if no instance had been created.
Definition at line 61 of file juce_MessageManager.cpp.
Definition at line 200 of file juce_MessageManager.cpp.
void juce::MessageManager::deregisterBroadcastListener | ( | ActionListener * | listener | ) |
Deregisters a broadcast listener.
Definition at line 214 of file juce_MessageManager.cpp.
|
staticnoexcept |
Returns true if there's an instance of the MessageManager, and if the current thread is running it.
Definition at line 254 of file juce_MessageManager.cpp.
|
staticnoexcept |
Returns true if there's an instance of the MessageManager, and if the current thread has the lock on it.
Definition at line 246 of file juce_MessageManager.cpp.
|
inlinenoexcept |
Returns the ID of the current message thread, as set by setCurrentThreadAsMessageThread().
(Best to ignore this method unless you really know what you're doing..)
Definition at line 139 of file juce_MessageManager.h.
|
static |
Returns the global instance of the MessageManager.
Definition at line 45 of file juce_MessageManager.cpp.
Referenced by juce::JUCEApplicationBase::quit().
|
staticnoexcept |
Returns the global instance of the MessageManager, or nullptr if it doesn't exist.
Definition at line 56 of file juce_MessageManager.cpp.
Referenced by existsAndIsCurrentThread(), existsAndIsLockedByCurrentThread(), and juce::AsyncUpdater::~AsyncUpdater().
|
inlinenoexcept |
Returns true if the stopDispatchLoop() method has been called.
Definition at line 85 of file juce_MessageManager.h.
|
noexcept |
Returns true if the caller-thread is the message thread.
Definition at line 221 of file juce_MessageManager.cpp.
Referenced by callFunctionOnMessageThread(), and runDispatchLoop().
void juce::MessageManager::registerBroadcastListener | ( | ActionListener * | listener | ) |
Registers a listener to get told about broadcast messages.
The actionListenerCallback() callback's string parameter is the message passed into broadcastMessage().
Definition at line 206 of file juce_MessageManager.cpp.
void juce::MessageManager::runDispatchLoop | ( | ) |
Runs the event dispatch loop until a stop message is posted.
This method is only intended to be run by the application's startup routine, as it blocks, and will only return after the stopDispatchLoop() method has been used.
Definition at line 120 of file juce_MessageManager.cpp.
void juce::MessageManager::setCurrentThreadAsMessageThread | ( | ) |
Called to tell the manager that the current thread is the one that's running the dispatch loop.
(Best to ignore this method unless you really know what you're doing..)
Definition at line 226 of file juce_MessageManager.cpp.
void juce::MessageManager::stopDispatchLoop | ( | ) |
Sends a signal that the dispatch loop should terminate.
After this is called, the runDispatchLoop() or runDispatchLoopUntil() methods will be interrupted and will return.
Definition at line 135 of file juce_MessageManager.cpp.