59 activeMessage->shouldDeliver.set (0);
68 if (activeMessage->shouldDeliver.compareAndSetBool (1, 0))
69 if (! activeMessage->post())
76 activeMessage->shouldDeliver.set (0);
84 if (activeMessage->shouldDeliver.exchange (0) != 0)
90 return activeMessage->shouldDeliver.value != 0;
void messageCallback() override
Called when the message is delivered.
Has a callback method that is triggered asynchronously.
bool isUpdatePending() const noexcept
Returns true if there's an update callback in the pipeline.
void handleUpdateNowIfNeeded()
If an update has been triggered and is pending, this will invoke it synchronously.
virtual void handleAsyncUpdate()=0
Called back to do whatever your class needs to do.
virtual ~AsyncUpdater()
Destructor.
void triggerAsyncUpdate()
Causes the callback to be triggered at a later time.
void cancelPendingUpdate() noexcept
This will stop any pending updates from happening.
AsyncUpdater()
Creates an AsyncUpdater object.
A message that invokes a callback method when it gets delivered.
static MessageManager * getInstanceWithoutCreating() noexcept
Returns the global instance of the MessageManager, or nullptr if it doesn't exist.
#define JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED
This macro is used to catch unsafe use of functions which expect to only be called on the message thr...
#define JUCE_ASSERT_MESSAGE_MANAGER_EXISTS
This macro is used to catch unsafe use of functions which expect to not be called outside the lifetim...
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.
bool compareAndSetBool(Type newValue, Type valueToCompare) noexcept
Atomically compares this value with a target value, and if it is equal, sets this to be equal to a ne...