30 class MessageManagerLock;
33 class ActionBroadcaster;
36 #if JUCE_MODULE_AVAILABLE_juce_opengl 42 using MessageCallbackFunction =
void* (
void* userData);
66 static void deleteInstance();
76 void runDispatchLoop();
85 void stopDispatchLoop();
91 #if JUCE_MODAL_LOOPS_PERMITTED || DOXYGEN 97 bool runDispatchLoopUntil (
int millisecondsToRunFor);
106 static bool callAsync (std::function<
void()> functionToCall);
126 void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
void* userData);
129 bool isThisTheMessageThread()
const noexcept;
136 void setCurrentThreadAsMessageThread();
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 };
341 static bool postMessageToSystemQueue (
MessageBase*);
342 static void* exitModalLoopCallback (
void*);
343 static void doPlatformSpecificInitialisation();
344 static void doPlatformSpecificShutdown();
345 static bool dispatchNextMessageOnSystemQueue (
bool returnIfNoPendingMessages);
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);
#define JUCE_API
This macro is added to all JUCE public class declarations.
Thread::ThreadID getCurrentMessageThread() const noexcept
Returns the ID of the current message thread, as set by setCurrentThreadAsMessageThread().
Interface class for delivery of events that are sent by an ActionBroadcaster.
void * ThreadID
A value type used for thread IDs.
bool lockWasGained() const noexcept
Returns true if the lock was successfully acquired.
Allows threads to wait for events triggered by other threads.
This class is in charge of the application's event-dispatch loop.
Used to receive callbacks for thread exit calls.
bool hasStopMessageBeenSent() const noexcept
Returns true if the stopDispatchLoop() method has been called.
A smart-pointer class which points to a reference-counted object.
Automatically locks and unlocks a mutex object.
A base class which provides methods for reference-counting.
A task that is executed by a ThreadPool object.
Automatically locks and unlocks a mutex object.
Used to make sure that the calling thread has exclusive access to the message loop.
Automatically unlocks and re-locks a mutex object.
Manages a list of ActionListeners, and can send them messages.
Internal class used as the base class for all message objects.
A lock you can use to lock the message manager.