This class allows to perform background operations without having to manipulate threads. More...
Public Member Functions | |
void | stopTasks (TaskType type) |
Stop tasks. More... | |
template<class F > | |
void | enqueue (TaskType type, const TaskCallBack &callback, void *callbackParam, F &&f) |
Enqueue a asynchronous task. More... | |
Static Public Member Functions | |
static AsyncTaskPool * | getInstance () |
Returns the shared instance of the async task pool. More... | |
local | getInstance () |
Returns the shared instance of the async task pool. More... | |
static void | destoryInstance () |
Destroys the async task pool. | |
local | destoryInstance () |
Destroys the async task pool. | |
This class allows to perform background operations without having to manipulate threads.
|
static |
Returns the shared instance of the async task pool.
instance of the async task pool.
|
static |
Returns the shared instance of the async task pool.
instance of the async task pool.
|
inline |
Stop tasks.
Task type you want to stop.
|
inline |
Stop tasks.
Task type you want to stop.
|
inline |
Enqueue a asynchronous task.
task type is io task, network task or others, each type of task has a thread to deal with it. callback when the task is finished. The callback is called in the main thread instead of task thread. parameter used by the callback. task can be lambda function.