Relative Content

Tag Archive for c++multithreadingconcurrencysynchronizationwaitgroup

How can I formally verify the correctness of my WaitGroup implementation in C++?

Description I’ve implemented a WaitGroup in C++ assuming that: user must ensure that the counter value does not drop below zero. WaitGroup can be reused. Below is my code: class WaitGroup { public: void Add(size_t count) { lock_guard<mutex> lock(mutex_); count_ += count; } void Done() { lock_guard<mutex> lock(mutex_); if (–count_ == 0) { cv_.notify_all(); } […]