Wait until the condition variable is notified or 'duration_us' microseconds have passed. Returns true if the condition variable is notified in time. Returns false otherwise.
| 62 | /// have passed. Returns true if the condition variable is notified in time. |
| 63 | /// Returns false otherwise. |
| 64 | bool WaitFor(std::unique_lock<std::mutex>& lock, int64_t duration_us) { |
| 65 | timespec deadline; |
| 66 | TimeFromNowMicros(duration_us, &deadline); |
| 67 | return WaitUntil(lock, deadline); |
| 68 | } |
| 69 | |
| 70 | /// Notify a single waiter on this condition variable. |
| 71 | void NotifyOne() { pthread_cond_signal(&cv_); } |
no test coverage detected