| 47 | } |
| 48 | |
| 49 | void PrefetchRunner::Start() { |
| 50 | { |
| 51 | mutex_lock l(mu_); |
| 52 | thread_nums_ = params_.fetch_ops().size(); |
| 53 | } |
| 54 | |
| 55 | thread_pool_.resize(thread_nums_); |
| 56 | for (size_t i = 0; i < thread_nums_; i++) |
| 57 | thread_pool_[i].reset(new std::thread(&PrefetchRunner::Run, this, i)); |
| 58 | |
| 59 | if (coord_) |
| 60 | cancel_thread_.reset(new std::thread(&PrefetchRunner::Stop, this)); |
| 61 | |
| 62 | is_running_ = true; |
| 63 | } |
| 64 | |
| 65 | void PrefetchRunner::Stop() { |
| 66 | if (coord_) |
no test coverage detected