MCPcopy Create free account
hub / github.com/ChunelFeng/CThreadPool / init

Method init

src/UtilsCtrl/ThreadPool/UThreadPool.cpp:50–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49
50CStatus UThreadPool::init() {
51 CGRAPH_FUNCTION_BEGIN
52 if (is_init_) {
53 CGRAPH_FUNCTION_END
54 }
55
56 primary_threads_.reserve(config_.default_thread_size_);
57 for (int i = 0; i < config_.default_thread_size_; i++) {
58 auto ptr = CGRAPH_SAFE_MALLOC_COBJECT(UThreadPrimary) // 创建核心线程数
59
60 ptr->setThreadPoolInfo(i, &task_queue_, &primary_threads_, &config_);
61 status += ptr->init();
62 primary_threads_.emplace_back(ptr);
63 }
64 CGRAPH_FUNCTION_CHECK_STATUS
65
66 is_init_ = true;
67 CGRAPH_FUNCTION_END
68}
69
70
71CStatus UThreadPool::submit(const UTaskGroup& taskGroup, CMSec ttl) {

Callers 2

UThreadPoolMethod · 0.95
createSecondaryThreadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected