26 class MessageManagerLock;
29 class ActionBroadcaster;
32 #if JUCE_MODULE_AVAILABLE_juce_opengl
38 using MessageCallbackFunction =
void* (
void* userData);
62 static void deleteInstance();
72 void runDispatchLoop();
81 void stopDispatchLoop();
87 #if JUCE_MODAL_LOOPS_PERMITTED || DOXYGEN
93 bool runDispatchLoopUntil (
int millisecondsToRunFor);
102 static bool callAsync (std::function<
void()> functionToCall);
122 void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
void* userData);
125 bool isThisTheMessageThread() const noexcept;
132 void setCurrentThreadAsMessageThread();
139 Thread::ThreadID getCurrentMessageThread() const noexcept {
return messageThreadId; }
148 bool currentThreadHasLockedMessageManager() const noexcept;
153 static
bool existsAndIsLockedByCurrentThread() noexcept;
158 static
bool existsAndIsCurrentThread() noexcept;
167 static
void broadcastMessage (const
String& messageText);
192 virtual void messageCallback() = 0;
231 void enter()
const noexcept;
276 bool tryEnter()
const noexcept;
281 void exit()
const noexcept;
289 void abort()
const noexcept;
302 struct BlockingMessage;
305 bool tryAcquire (
bool)
const noexcept;
306 void messageCallback()
const;
317 void deliverBroadcastMessage (
const String&);
329 friend class QuitMessage;
333 Atomic<
int> quitMessagePosted { 0 }, quitMessageReceived { 0 };
335 Atomic<Thread::ThreadID> threadWithLock;
337 static bool postMessageToSystemQueue (MessageBase*);
338 static void* exitModalLoopCallback (
void*);
339 static void doPlatformSpecificInitialisation();
340 static void doPlatformSpecificShutdown();
341 static bool dispatchNextMessageOnSystemQueue (
bool returnIfNoPendingMessages);
343 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageManager)
460 void exitSignalSent()
override;
471 #define JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED \
472 jassert (juce::MessageManager::existsAndIsLockedByCurrentThread());
479 #define JUCE_ASSERT_MESSAGE_THREAD \
480 jassert (juce::MessageManager::existsAndIsCurrentThread());
485 #define JUCE_ASSERT_MESSAGE_MANAGER_EXISTS \
486 jassert (juce::MessageManager::getInstanceWithoutCreating() != nullptr);
bool lockWasGained() const noexcept
bool hasStopMessageBeenSent() const noexcept