diff --git a/cocos/base/CCAsyncTaskPool.h b/cocos/base/CCAsyncTaskPool.h index 7d97e975cf..fd3d00593d 100644 --- a/cocos/base/CCAsyncTaskPool.h +++ b/cocos/base/CCAsyncTaskPool.h @@ -80,6 +80,14 @@ public: _taskcallbackDispatcher.update(); } + /** + * enqueue a asynchronous task + * @param type task type is io task, network task or others, each type of task has a thread to deal with it. + * @param callback callback when the task is finished. The callback is called in the main thread instead of task thread + * @param callbackParam parameter used by the callback + * @f task can be lambda function + * @args task parameters + */ template auto enqueue(TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f, Args&&... args) -> std::future::type>;