30 : callback (std::move (
cb)) {}
71 NullCheckedInvocation::invoke (callback);
82 : impl (new
Impl (
std::move (callbackToUse))) {}
119 impl->messageCallback();
127 return impl->isPending();
A message that invokes a callback method when it gets delivered.
Automatically locks and unlocks a mutex object.
void messageCallback() override
Called when the message is delivered.
A bit like an AsyncUpdater, but guarantees that after cancelPendingUpdate() returns,...
bool isUpdatePending() const noexcept
Returns true if there's an update callback in the pipeline.
void triggerAsyncUpdate()
Causes the callback to be triggered at a later time.
LockingAsyncUpdater & operator=(LockingAsyncUpdater &&other) noexcept
Move assignment operator.
void cancelPendingUpdate() noexcept
This will stop any pending updates from happening.
~LockingAsyncUpdater()
Destructor.
void handleUpdateNowIfNeeded()
If an update has been triggered and is pending, this will invoke it synchronously.
LockingAsyncUpdater(std::function< void()> callbackToUse)
Creates a LockingAsyncUpdater object that will call the provided callback on the main thread when tri...
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...