Albert
|
#include <albert/backgroundexecutor.h>
Provides a lean interface for recurring indexing tasks.
Takes care of the QtConcurrent boilerplate code to start, abort and schedule restarts of threads.
T | The type of results this executor produces. |
Public Member Functions | |
BackgroundExecutor () | |
~BackgroundExecutor () | |
void | run () |
Run or schedule a rerun of the task. | |
bool | isRunning () const |
Returns true if the asynchronous computation is currently running; otherwise returns false . | |
Public Attributes | |
std::function< T(const bool &abort)> | parallel |
The task that should be executed in background. | |
std::function< void(T &&results)> | finish |
The results handler. | |
std::chrono::milliseconds | runtime |
The runtime of the last execution of parallel. | |
|
inline |
|
inline |
|
inline |
Returns true
if the asynchronous computation is currently running; otherwise returns false
.
|
inline |
Run or schedule a rerun of the task.
If a task is running this function sets the abort flag and schedules a rerun. finish
will not be called for the cancelled run.
std::function<void(T && results)> albert::BackgroundExecutor< T >::finish |
The results handler.
When the parallel function finished, this function will be called in the main thread with the results returned by the parallel function.
results | The results parallel returned. |
std::function<T(const bool &abort)> albert::BackgroundExecutor< T >::parallel |
The task that should be executed in background.
This function is executed in a separate thread.
abort | The abort flag |
std::chrono::milliseconds albert::BackgroundExecutor< T >::runtime |
The runtime of the last execution of parallel.