MCPcopy Create free account
hub / github.com/ChunelFeng/CGraph / reset

Function reset

src/UtilsCtrl/ThreadPool/Thread/UThreadBase.h:107–121  ·  view source on GitHub ↗

* 清空所有任务内容 */

Source from the content-addressed store, hash-verified

105 * 清空所有任务内容
106 */
107 CVoid reset() {
108 {
109 // 这里必须要加 lock,避免退出的时候,cv_.wait_for() 的 pred竞争
110 CGRAPH_UNIQUE_LOCK lk(mutex_);
111 done_ = false;
112 }
113
114 cv_.notify_one(); // 防止主线程 wait时间过长,导致的结束缓慢问题
115 if (thread_.joinable()) {
116 thread_.join(); // 等待线程结束
117 }
118 is_init_ = false;
119 is_running_ = false;
120 total_task_num_ = 0;
121 }
122
123
124 /**

Callers 2

~UThreadBaseFunction · 0.70
destroyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected