任务组改为集中任务组

This commit is contained in:
fasiondog 2024-08-12 17:37:53 +08:00
parent 69730916cc
commit 9d9e03c758
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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>;