| 65 | } |
| 66 | |
| 67 | void AsyncGroup::blockingWait() { |
| 68 | std::unique_lock<Mutex> guard(_mutex); |
| 69 | if (_enterCount == 0) { |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | auto cond = Valdi::makeShared<ConditionVariable>(); |
| 74 | |
| 75 | while (_enterCount != 0) { |
| 76 | auto functionId = lockFreeEnqueueFunction([cond]() { cond->notifyAll(); }); |
| 77 | |
| 78 | cond->wait(guard); |
| 79 | |
| 80 | lockFreeRemoveFunction(functionId); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | bool AsyncGroup::blockingWaitWithTimeout(const std::chrono::steady_clock::duration& maxTime) { |
| 85 | std::unique_lock<Mutex> guard(_mutex); |