#include <updatejobevent.h>
Update Job Event class collects and combine multiple update calls into one call until executed. This is useful when adding multiple update events for the same ui element but if you only want to execute one redraw update. As soon as the update job starts all subsequent request calls will trigger a new update.
The update will be called only once if the main thread is blocked or too slow when calling the RequestUpdate functions.
Public Member Functions | |
~UpdateJobEvent () | |
Result< void > | Init (const Delegate< void()> &updateDelegate, const JobQueueRef &jobQueueRef) |
void | Free () |
void | Init (Delegate< void()> &&updateDelegate, const JobQueueRef &jobQueueRef) |
Bool | IsInitialized () const |
Result< void > | RequestUpdate (Bool cancelCurrentJob=true) |
Private Attributes | |
AtomicBool | _updateRequested |
Delegate< void()> | _updateDelegate |
JobQueueRef | _updateJobQueueRef |
JobRef | _lastUpdateJob |
~UpdateJobEvent | ( | ) |
Result<void> Init | ( | const Delegate< void()> & | updateDelegate, |
const JobQueueRef & | jobQueueRef | ||
) |
Initializes the callback function and queue.
[in] | updateDelegate | Code to execute in update call. |
[in] | jobQueueRef | Job queue to execute the code. |
void Free | ( | ) |
Free Structure.
void Init | ( | Delegate< void()> && | updateDelegate, |
const JobQueueRef & | jobQueueRef | ||
) |
Initializes the callback function and queue.
[in] | updateDelegate | Code to execute in update call. |
[in] | jobQueueRef | Job queue to execute the code. |
Bool IsInitialized | ( | ) | const |
IsInitialized returns true if initialized.
RequestUpdate enqueues a new update job into the given queue.
[in] | cancelCurrentJob | If true (the default) and there's a currently running update job, the function cancels the job and waits for that. Make sure that this doesn't introduce dead locks. |
|
private |
|
private |
|
private |
|
private |