mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-02 03:48:19 +08:00
任务组改为集中任务组
This commit is contained in:
parent
69730916cc
commit
9d9e03c758
@ -13,9 +13,9 @@
|
||||
|
||||
namespace hku {
|
||||
|
||||
static StealThreadPool* g_threadPool;
|
||||
static ThreadPool* g_threadPool;
|
||||
|
||||
StealThreadPool* getGlobalTaskGroup() {
|
||||
ThreadPool* getGlobalTaskGroup() {
|
||||
static std::once_flag oc;
|
||||
std::call_once(oc, [&]() {
|
||||
auto cpu_num = std::thread::hardware_concurrency();
|
||||
@ -24,7 +24,7 @@ StealThreadPool* getGlobalTaskGroup() {
|
||||
} else if (cpu_num > 1) {
|
||||
cpu_num--;
|
||||
}
|
||||
g_threadPool = new StealThreadPool(cpu_num);
|
||||
g_threadPool = new ThreadPool(cpu_num);
|
||||
});
|
||||
return g_threadPool;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef HKU_GLOBAL_TASK_GROUP
|
||||
#define HKU_GLOBAL_TASK_GROUP
|
||||
|
||||
#include "../utilities/thread/StealThreadPool.h"
|
||||
#include "../utilities/thread/thread.h"
|
||||
|
||||
namespace hku {
|
||||
|
||||
@ -19,7 +19,7 @@ namespace hku {
|
||||
* 获取全局线程池任务组
|
||||
* @note 请使用 future 获取任务返回
|
||||
*/
|
||||
StealThreadPool* getGlobalTaskGroup();
|
||||
ThreadPool* getGlobalTaskGroup();
|
||||
|
||||
template <typename ResultType>
|
||||
using task_handle = std::future<ResultType>;
|
||||
|
Loading…
Reference in New Issue
Block a user