Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
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. 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.
 

Detailed Description

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

Member Function Documentation

static AsyncTaskPool* getInstance ( )
static

Returns the shared instance of the async task pool.

instance of the async task pool.

local getInstance ( )
static

Returns the shared instance of the async task pool.

instance of the async task pool.

void stopTasks ( TaskType  type)
inline

Stop tasks.

Task type you want to stop.

local stopTasks ( local  type)
inline

Stop tasks.

Task type you want to stop.

void enqueue ( AsyncTaskPool::TaskType  type,
const TaskCallBack &  callback,
void *  callbackParam,
F &&  f 
)
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.


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