#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 (UPDATEJOBEVENTMODE mode, const Delegate< void()> &updateDelegate, const JobQueueRef &jobQueueRef) |
void | Free () |
void | Init (UPDATEJOBEVENTMODE mode, Delegate< void()> &&updateDelegate, const JobQueueRef &jobQueueRef) |
Bool | IsInitialized () const |
Result< void > | RequestUpdate () |
Private Attributes | |
UPDATEJOBEVENTMODE | _mode |
AtomicBool | _updateRequested |
AtomicInt | _delayedRequests |
Delegate< void()> | _updateDelegate |
JobQueueRef | _updateJobQueueRef |
JobRef | _lastUpdateJob |
~UpdateJobEvent | ( | ) |
Result<void> Init | ( | UPDATEJOBEVENTMODE | mode, |
const Delegate< void()> & | updateDelegate, | ||
const JobQueueRef & | jobQueueRef | ||
) |
Initializes the callback function and queue. @parem[in] mode see UPDATEJOBEVENTMODE.
[in] | updateDelegate | Code to execute in update call. |
[in] | jobQueueRef | Job queue to execute the code. |
void Free | ( | ) |
Free Structure.
void Init | ( | UPDATEJOBEVENTMODE | mode, |
Delegate< void()> && | updateDelegate, | ||
const JobQueueRef & | jobQueueRef | ||
) |
Initializes the callback function and queue. @parem[in] mode see UPDATEJOBEVENTMODE.
[in] | updateDelegate | Code to execute in update call. |
[in] | jobQueueRef | Job queue to execute the code. |
Bool IsInitialized | ( | ) | const |
IsInitialized returns true if initialized.
Result<void> RequestUpdate | ( | ) |
RequestUpdate enqueues a new update job into the given queue.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |