* 判断本线程是否需要被自动释放 * @return */
| 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 | |
| 121 | private: |
| 122 | int cur_ttl_ = 0; // 当前最大生存周期 |
nothing calls this directly
no outgoing calls
no test coverage detected