Cocos2d-x  4.0.0
Public Member Functions | Static Public Member Functions | List of all members
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.
 
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 Public Member Functions

static AsyncTaskPoolgetInstance ()
 Returns the shared instance of the async task pool.
 
static void destroyInstance ()
 Destroys the async task pool.
 

Detailed Description

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

NA

Member Function Documentation

void stopTasks ( TaskType  type)
inline

Stop tasks.

Parameters
typeTask type you want to stop.
void enqueue ( AsyncTaskPool::TaskType  type,
TaskCallBack  callback,
void *  callbackParam,
std::function< void()>  task 
)
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.
task,:task can be lambda function to be performed off thread. NA
void enqueue ( AsyncTaskPool::TaskType  type,
std::function< void()>  task 
)
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.
task,:task can be lambda function to be performed off thread. NA

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