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

Function freeze

src/UtilsCtrl/ThreadPool/Thread/UThreadSecondary.h:110–119  ·  view source on GitHub ↗

* 判断本线程是否需要被自动释放 * @return */

Source from the content-addressed store, hash-verified

108 * @return
109 */
110 bool freeze() {
111 if (likely(is_running_)) {
112 cur_ttl_++;
113 cur_ttl_ = std::min(cur_ttl_, config_->secondary_thread_ttl_);
114 } else {
115 cur_ttl_--; // 如果当前线程没有在执行,则ttl-1
116 }
117
118 return cur_ttl_ <= 0;
119 }
120
121private:
122 int cur_ttl_ = 0; // 当前最大生存周期

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected