Skip to content

Commit

Permalink
bugfix: 修复了在windows上,线程池init时候,偶现异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Jan 13, 2024
1 parent d6306ef commit 781a02e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/UtilsCtrl/ThreadPool/UThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ CStatus UThreadPool::init() {
for (int i = 0; i < config_.default_thread_size_; i++) {
auto ptr = CGRAPH_SAFE_MALLOC_COBJECT(UThreadPrimary); // 创建核心线程数
ptr->setThreadPoolInfo(i, &task_queue_, &primary_threads_, &config_);
status += ptr->init();

// 记录线程和匹配id信息
thread_record_map_[(CSize)std::hash<std::thread::id>{}(ptr->thread_.get_id())] = i;
primary_threads_.emplace_back(ptr);
}

for (auto* pt : primary_threads_) {
status += pt->init();
}
CGRAPH_FUNCTION_CHECK_STATUS

/**
Expand Down

0 comments on commit 781a02e

Please sign in to comment.