Cocos2d-x  v3.15
AsyncTaskPool Class Reference

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 AsyncTaskPoolgetInstance ()
 Returns the shared instance of the async task pool.
 
static void destroyInstance ()
 Destroys the async task pool.
 
static void destoryInstance ()
 

Detailed Description

This class allows to perform background operations without having to manipulate threads.

NA

Member Function Documentation

◆ destoryInstance()

static void destoryInstance ( )
inlinestatic

◆ stopTasks()

void stopTasks ( TaskType  type)
inline

Stop tasks.

Parameters
typeTask type you want to stop.

◆ enqueue()

void enqueue ( AsyncTaskPool::TaskType  type,
const TaskCallBack &  callback,
void *  callbackParam,
F &&  f 
)
inline

Enqueue a asynchronous task.

Parameters
typetask type is io task, network task or others, each type of task has a thread to deal with it.
callbackcallback when the task is finished. The callback is called in the main thread instead of task thread.
callbackParamparameter used by the callback.
ftask can be lambda function. NA

The documentation for this class was generated from the following file: