26class MessageManagerLock;
29class ActionBroadcaster;
33using MessageCallbackFunction =
void* (
void* userData);
57 static void deleteInstance();
67 void runDispatchLoop();
76 void stopDispatchLoop();
82 #if JUCE_MODAL_LOOPS_PERMITTED
88 bool runDispatchLoopUntil (
int millisecondsToRunFor);
97 static bool callAsync (std::function<
void()> functionToCall);
117 void* callFunctionOnMessageThread (MessageCallbackFunction* callback,
void* userData);
120 bool isThisTheMessageThread() const noexcept;
127 void setCurrentThreadAsMessageThread();
134 Thread::ThreadID getCurrentMessageThread() const noexcept {
return messageThreadId; }
143 bool currentThreadHasLockedMessageManager() const noexcept;
148 static
bool existsAndIsLockedByCurrentThread() noexcept;
153 static
bool existsAndIsCurrentThread() noexcept;
162 static
void broadcastMessage (const
String& messageText);
187 virtual void messageCallback() = 0;
226 void enter()
const noexcept;
271 bool tryEnter()
const noexcept;
276 void exit()
const noexcept;
284 void abort()
const noexcept;
297 struct BlockingMessage;
300 bool exclusiveTryAcquire (
bool)
const noexcept;
301 bool tryAcquire (
bool)
const noexcept;
303 void setAcquired (
bool success)
const noexcept;
313 mutable std::mutex mutex;
315 mutable std::condition_variable condvar;
316 mutable bool abortWait =
false, acquired =
false;
322 void deliverBroadcastMessage (
const String&);
334 friend class QuitMessage;
338 Atomic<
int> quitMessagePosted { 0 }, quitMessageReceived { 0 };
340 Atomic<Thread::ThreadID> threadWithLock;
341 mutable std::mutex messageThreadIdMutex;
343 static bool postMessageToSystemQueue (MessageBase*);
344 static void* exitModalLoopCallback (
void*);
345 static void doPlatformSpecificInitialisation();
346 static void doPlatformSpecificShutdown();
348 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageManager)
465 void exitSignalSent()
override;
476#define JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED \
477 jassert (juce::MessageManager::existsAndIsLockedByCurrentThread());
484#define JUCE_ASSERT_MESSAGE_THREAD \
485 jassert (juce::MessageManager::existsAndIsCurrentThread());
490#define JUCE_ASSERT_MESSAGE_MANAGER_EXISTS \
491 jassert (juce::MessageManager::getInstanceWithoutCreating() != nullptr);
bool lockWasGained() const noexcept
bool hasStopMessageBeenSent() const noexcept