| 17 | { } |
| 18 | |
| 19 | void TCountDownLatch::CountDown() |
| 20 | { |
| 21 | #ifndef _linux_ |
| 22 | TGuard<TMutex> guard(Mutex_); |
| 23 | #endif |
| 24 | auto previous = Count_.fetch_sub(1, std::memory_order::release); |
| 25 | if (previous == 1) { |
| 26 | #ifdef _linux_ |
| 27 | int rv = NThreading::FutexWake( |
| 28 | reinterpret_cast<int*>(&Count_), |
| 29 | std::numeric_limits<int>::max()); |
| 30 | YT_VERIFY(rv >= 0); |
| 31 | #else |
| 32 | ConditionVariable_.BroadCast(); |
| 33 | #endif |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | void TCountDownLatch::Wait() const |
| 38 | { |