| 184 | |
| 185 | |
| 186 | CStatus UThreadPool::releaseSecondaryThread(CInt size) { |
| 187 | CGRAPH_FUNCTION_BEGIN |
| 188 | |
| 189 | // 先将所有已经结束的,给删掉 |
| 190 | CGRAPH_LOCK_GUARD lock(st_mutex_); |
| 191 | for (auto iter = secondary_threads_.begin(); iter != secondary_threads_.end(); ) { |
| 192 | !(*iter)->done_ ? secondary_threads_.erase(iter++) : iter++; |
| 193 | } |
| 194 | |
| 195 | CGRAPH_RETURN_ERROR_STATUS_BY_CONDITION((size > static_cast<CInt>(secondary_threads_.size())), \ |
| 196 | "cannot release [" + std::to_string(size) + "] secondary thread," \ |
| 197 | + "only [" + std::to_string(secondary_threads_.size()) + "] left.") |
| 198 | |
| 199 | // 再标记几个需要删除的信息 |
| 200 | for (auto iter = secondary_threads_.begin(); |
| 201 | iter != secondary_threads_.end() && size-- > 0; ) { |
| 202 | (*iter)->done_ = false; |
| 203 | ++iter; |
| 204 | } |
| 205 | CGRAPH_FUNCTION_END |
| 206 | } |
| 207 | |
| 208 | |
| 209 | CIndex UThreadPool::dispatch(const CIndex origIndex) { |
nothing calls this directly
no outgoing calls
no test coverage detected