[RouteHelper] Add WaitForUnicastIP

This commit is contained in:
Connection Refused
2021-11-10 14:09:38 +08:00
parent f68ed1abf0
commit d3814ca945
8 changed files with 98 additions and 22 deletions

19
RouteHelper/WaitGroup.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include "WaitGroup.h"
void WaitGroup::Add(int size)
{
this->counter += size;
}
void WaitGroup::Done()
{
if (--this->counter <= 0)
this->condition.notify_all();
}
void WaitGroup::Wait()
{
std::unique_lock<std::mutex> lock(this->mutex);
condition.wait(lock, [&] { return counter <= 0; });
}