| 28 | } |
| 29 | |
| 30 | bool BlockingCounter::DecrementCount() { |
| 31 | int old_count_value = count_.fetch_sub(1, std::memory_order_acq_rel); |
| 32 | RUY_DCHECK_GT(old_count_value, 0); |
| 33 | int count_value = old_count_value - 1; |
| 34 | bool hit_zero = (count_value == 0); |
| 35 | if (hit_zero) { |
| 36 | std::lock_guard<std::mutex> lock(count_mutex_); |
| 37 | count_cond_.notify_all(); |
| 38 | } |
| 39 | return hit_zero; |
| 40 | } |
| 41 | |
| 42 | void BlockingCounter::Wait() { |
| 43 | const auto& condition = [this]() { |