26class MessageManagerLock;
29class ActionBroadcaster;
57 static void deleteInstance();
67 void runDispatchLoop();
76 void stopDispatchLoop();
82 #if JUCE_MODAL_LOOPS_PERMITTED
88 bool runDispatchLoopUntil (
int millisecondsToRunFor);
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;
300 bool exclusiveTryAcquire (
bool)
const noexcept;
301 bool tryAcquire (
bool)
const noexcept;
303 void setAcquired (
bool success)
const noexcept;
316 mutable bool abortWait =
false, acquired =
false;
322 void deliverBroadcastMessage (
const String&);
338 Atomic<
int> quitMessagePosted { 0 }, quitMessageReceived { 0 };
339 Thread::ThreadID messageThreadId;
340 Atomic<Thread::ThreadID> threadWithLock;
343 static bool postMessageToSystemQueue (MessageBase*);
344 static void* exitModalLoopCallback (
void*);
345 static void doPlatformSpecificInitialisation();
346 static void doPlatformSpecificShutdown();
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);
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 hasStopMessageBeenSent() const noexcept
Returns true if the stopDispatchLoop() method has been called.
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 *(void *userData) MessageCallbackFunction
See MessageManager::callFunctionOnMessageThread() for use of this function type.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
A simple wrapper around std::atomic.