Skip to content

Commit bff5a6a

Browse files
committed
feat(combinate): 使用全局任务组替换线程池实现, 将组合指标分析中的ThreadPool替换为全局任务组
1 parent ac299a9 commit bff5a6a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hikyuu_cpp/hikyuu/analysis/combinate.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ vector<CombinateAnalysisOutput> HKU_API combinateIndicatorAnalysisWithBlock(
7575
size_t total = stocks.size();
7676
HKU_IF_RETURN(total == 0, result);
7777

78-
auto work_num = std::thread::hardware_concurrency();
79-
ThreadPool tg(work_num);
78+
// auto work_num = std::thread::hardware_concurrency();
79+
// ThreadPool tg(work_num);
80+
auto* tg = get_global_task_group();
8081
vector<std::future<vector<CombinateAnalysisOutput>>> tasks;
8182

8283
vector<Stock> buf;
@@ -86,8 +87,8 @@ vector<CombinateAnalysisOutput> HKU_API combinateIndicatorAnalysisWithBlock(
8687
for (size_t i = range.first; i < range.second; i++) {
8788
buf.emplace_back(stocks[i]);
8889
}
89-
tasks.emplace_back(tg.submit([sgs, stks = std::move(buf), n_query = query,
90-
n_tm = tm->clone(), n_sys = sys->clone()]() {
90+
tasks.emplace_back(tg->submit([sgs, stks = std::move(buf), n_query = query,
91+
n_tm = tm->clone(), n_sys = sys->clone()]() {
9192
vector<CombinateAnalysisOutput> ret;
9293
Performance per;
9394
CombinateAnalysisOutput out;

0 commit comments

Comments
 (0)