This class allows to perform background operations without having to manipulate threads.
More...
#include <AsyncTaskPool.h>
|
void | stopTasks (TaskType type) |
| Stop tasks.
|
|
void | enqueue (TaskType type, TaskCallBack callback, void *callbackParam, std::function< void()> task) |
| Enqueue a asynchronous task.
|
|
void | enqueue (AsyncTaskPool::TaskType type, std::function< void()> task) |
| Enqueue a asynchronous task.
|
|
|
static AsyncTaskPool * | getInstance () |
| Returns the shared instance of the async task pool.
|
|
static void | destroyInstance () |
| Destroys the async task pool.
|
|
This class allows to perform background operations without having to manipulate threads.
@js NA
◆ stopTasks()
void stopTasks |
( |
TaskType | type | ) |
|
|
inline |
Stop tasks.
- Parameters
-
type | Task type you want to stop. |
◆ enqueue() [1/2]
void enqueue |
( |
AsyncTaskPool::TaskType | type, |
|
|
TaskCallBack | callback, |
|
|
void * | callbackParam, |
|
|
std::function< void()> | task ) |
|
inline |
Enqueue a asynchronous task.
- Parameters
-
type | task type is io task, network task or others, each type of task has a thread to deal with it. |
callback | callback when the task is finished. The callback is called in the main thread instead of task thread. |
callbackParam | parameter used by the callback. |
task | task can be lambda function to be performed off thread. @lua NA |
◆ enqueue() [2/2]
void enqueue |
( |
AsyncTaskPool::TaskType | type, |
|
|
std::function< void()> | task ) |
|
inline |
Enqueue a asynchronous task.
- Parameters
-
type | task type is io task, network task or others, each type of task has a thread to deal with it. |
task | task can be lambda function to be performed off thread. @lua NA |
The documentation for this class was generated from the following file: