Skip to content

Commit 71b8540

Browse files
committed
Bug fix
1 parent 52b60b2 commit 71b8540

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/utils/count_down_latch.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace disruptor4cpp
4343
class count_down_latch
4444
{
4545
public:
46-
explicit count_down_latch(std::size_t count)
46+
explicit count_down_latch(int count)
4747
: count_(count)
4848
{
4949
}
@@ -62,13 +62,13 @@ namespace disruptor4cpp
6262
bool wait(const std::chrono::duration<Rep, Period>& timeout)
6363
{
6464
std::unique_lock<std::mutex> lock(mutex_);
65-
return condition_.wait_for(lock, timeout, [this] { return count_ == 0; });
65+
return condition_.wait_for(lock, timeout, [this] { return count_ <= 0; });
6666
}
6767

6868
void count_down()
6969
{
7070
std::lock_guard<std::mutex> lock(mutex_);
71-
if (--count_ == 0)
71+
if (--count_ <= 0)
7272
condition_.notify_all();
7373
}
7474

@@ -80,7 +80,7 @@ namespace disruptor4cpp
8080

8181
std::mutex mutex_;
8282
std::condition_variable condition_;
83-
std::size_t count_;
83+
int count_;
8484
};
8585
}
8686
}

0 commit comments

Comments
 (0)