|
Gin
|
An asynchronous update dispatcher that bypasses the message queue. More...
#include <gin_realtimeasyncupdater.h>
Public Member Functions | |
| RealtimeAsyncUpdater () | |
| Creates a RealtimeAsyncUpdater. | |
| virtual | ~RealtimeAsyncUpdater () |
| Destructor. | |
| void | triggerAsyncUpdate () |
| Triggers an asynchronous update. | |
| void | cancelPendingUpdate () noexcept |
| Cancels any pending update. | |
| void | handleUpdateNowIfNeeded () |
| Handles the update immediately if one is pending. | |
| bool | isUpdatePending () const noexcept |
| Checks if an update is currently pending. | |
| virtual void | handleAsyncUpdate ()=0 |
| Called asynchronously when an update is triggered. | |
An asynchronous update dispatcher that bypasses the message queue.
Similar to juce::AsyncUpdater, but uses a dedicated background thread instead of the message queue. This makes it suitable for real-time applications where the message queue might introduce unacceptable latency or where the message thread might be blocked.
Multiple calls to triggerAsyncUpdate() are coalesced - if called multiple times before handleAsyncUpdate() runs, it will only be called once.
| RealtimeAsyncUpdater::RealtimeAsyncUpdater | ( | ) |
Creates a RealtimeAsyncUpdater.
|
virtual |
Destructor.
Cancels any pending updates.
| void RealtimeAsyncUpdater::triggerAsyncUpdate | ( | ) |
Triggers an asynchronous update.
Schedules handleAsyncUpdate() to be called on a background thread. Multiple calls before the update executes are coalesced into a single callback. This method is thread-safe and can be called from any thread, including real-time audio threads.
|
noexcept |
Cancels any pending update.
Prevents handleAsyncUpdate() from being called if it hasn't executed yet. This is thread-safe.
| void RealtimeAsyncUpdater::handleUpdateNowIfNeeded | ( | ) |
Handles the update immediately if one is pending.
If an update has been triggered but not yet executed, this will execute it immediately on the current thread and cancel the pending background execution.
|
noexcept |
Checks if an update is currently pending.
Called asynchronously when an update is triggered.
Override this method to perform your update logic. This will be called on a dedicated background thread (not the message thread).