| 233 | } |
| 234 | |
| 235 | void Start() { |
| 236 | { |
| 237 | mutex_lock l(mu_); |
| 238 | num_pending_ = targets_.size(); |
| 239 | if (num_pending_ == 0) { |
| 240 | pending_zero_.notify_all(); |
| 241 | } |
| 242 | } |
| 243 | // Talk to all workers to get the list of available devices. |
| 244 | using std::placeholders::_1; |
| 245 | using std::placeholders::_2; |
| 246 | for (size_t i = 0; i < targets_.size(); ++i) { |
| 247 | // TODO(mrry): Propagate a timeout here, since `this->WhenFound()` may |
| 248 | // never be called. |
| 249 | NewRemoteDevices(env_->env, worker_cache_, targets_[i], |
| 250 | std::bind(&ME::WhenFound, this, i, _1, _2)); |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | // Every `kLoggingPeriodMs`, while the DeviceFinder is still waiting |
| 255 | // to hear from workers, log a list of the workers who have not |