mirror of
https://github.com/bolucat/Archive.git
synced 2025-09-27 12:33:06 +08:00
19 lines
268 B
C++
19 lines
268 B
C++
#pragma once
|
|
#ifndef WAITGROUP_H
|
|
#define WAITGROUP_H
|
|
#include "Based.h"
|
|
|
|
class WaitGroup {
|
|
public:
|
|
void Add(int size);
|
|
void Done();
|
|
void Wait();
|
|
|
|
private:
|
|
std::mutex mutex;
|
|
std::atomic_int counter;
|
|
std::condition_variable condition;
|
|
};
|
|
|
|
#endif
|