30class MessageManagerLock;
33class ActionBroadcaster;
36#if JUCE_MODULE_AVAILABLE_juce_opengl
42using MessageCallbackFunction =
void* (
void* userData);
66 static void deleteInstance();
91 #if JUCE_MODAL_LOOPS_PERMITTED || DOXYGEN
106 static bool callAsync (std::function<
void()> functionToCall);
126 void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
void* userData);
129 bool isThisTheMessageThread() const noexcept;
136 void setCurrentThreadAsMessageThread();
143 Thread::ThreadID getCurrentMessageThread() const noexcept {
return messageThreadId; }
152 bool currentThreadHasLockedMessageManager() const noexcept;
157 static
bool existsAndIsLockedByCurrentThread() noexcept;
162 static
bool existsAndIsCurrentThread() noexcept;
171 static
void broadcastMessage (const
String& messageText);
196 virtual void messageCallback() = 0;
235 void enter()
const noexcept;
280 bool tryEnter()
const noexcept;
285 void exit()
const noexcept;
293 void abort()
const noexcept;
309 bool tryAcquire (
bool)
const noexcept;
310 void messageCallback()
const;
321 void deliverBroadcastMessage (
const String&);
333 friend class QuitMessage;
337 Atomic<
int> quitMessagePosted { 0 }, quitMessageReceived { 0 };
339 Atomic<Thread::ThreadID> threadWithLock;
341 static bool postMessageToSystemQueue (MessageBase*);
342 static void* exitModalLoopCallback (
void*);
343 static void doPlatformSpecificInitialisation();
344 static void doPlatformSpecificShutdown();
345 static bool dispatchNextMessageOnSystemQueue (
bool returnIfNoPendingMessages);
347 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageManager)
464 void exitSignalSent()
override;
475#define JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED \
476 jassert (juce::MessageManager::existsAndIsLockedByCurrentThread());
483#define JUCE_ASSERT_MESSAGE_THREAD \
484 jassert (juce::MessageManager::existsAndIsCurrentThread());
489#define JUCE_ASSERT_MESSAGE_MANAGER_EXISTS \
490 jassert (juce::MessageManager::getInstanceWithoutCreating() != nullptr);
Manages a list of ActionListeners, and can send them messages.
Interface class for delivery of events that are sent by an ActionBroadcaster.
Automatically locks and unlocks a mutex object.
Automatically locks and unlocks a mutex object.
Automatically unlocks and re-locks a mutex object.
Used to make sure that the calling thread has exclusive access to the message loop.
bool lockWasGained() const noexcept
Returns true if the lock was successfully acquired.
A lock you can use to lock the message manager.
Internal class used as the base class for all message objects.
This class is in charge of the application's event-dispatch loop.
bool runDispatchLoopUntil(int millisecondsToRunFor)
Synchronously dispatches messages until a given time has elapsed.
void runDispatchLoop()
Runs the event dispatch loop until a stop message is posted.
bool hasStopMessageBeenSent() const noexcept
Returns true if the stopDispatchLoop() method has been called.
void stopDispatchLoop()
Sends a signal that the dispatch loop should terminate.
A smart-pointer class which points to a reference-counted object.
A base class which provides methods for reference-counting.
A task that is executed by a ThreadPool object.
Used to receive callbacks for thread exit calls.
void * ThreadID
A value type used for thread IDs.
Allows threads to wait for events triggered by other threads.
#define JUCE_API
This macro is added to all JUCE public class declarations.