| 1302 | } |
| 1303 | |
| 1304 | bool ClientRequestState::BlockOnWait(int64_t timeout_us, int64_t* block_on_wait_time_us) { |
| 1305 | DCHECK_GE(timeout_us, 0); |
| 1306 | unique_lock<mutex> l(lock_); |
| 1307 | *block_on_wait_time_us = 0; |
| 1308 | // Some metadata operations like GET_COLUMNS do not rely on WaitAsync() to launch |
| 1309 | // the wait thread. In such cases this method is expected to be a no-op. |
| 1310 | if (wait_thread_.get() == nullptr) return true; |
| 1311 | while (!is_wait_done_) { |
| 1312 | if (timeout_us == 0) { |
| 1313 | block_on_wait_cv_.Wait(l); |
| 1314 | return true; |
| 1315 | } else { |
| 1316 | MonotonicStopWatch wait_timeout_timer; |
| 1317 | wait_timeout_timer.Start(); |
| 1318 | bool notified = block_on_wait_cv_.WaitFor(l, timeout_us); |
| 1319 | if (notified) { |
| 1320 | *block_on_wait_time_us = wait_timeout_timer.ElapsedTime() / NANOS_PER_MICRO; |
| 1321 | } |
| 1322 | return notified; |
| 1323 | } |
| 1324 | } |
| 1325 | return true; |
| 1326 | } |
| 1327 | |
| 1328 | void ClientRequestState::Wait() { |
| 1329 | // block until results are ready |
nothing calls this directly
no test coverage detected