Skip to content

Commit

Permalink
CondVar::SignalAll was broken, leading to deadlocks on Windows builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Makhnychev authored and sipa committed Aug 17, 2013
1 parent f6d84d1 commit 8487468
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions port/port_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,10 @@ void CondVar::Signal() {

void CondVar::SignalAll() {
wait_mtx_.Lock();
for(long i = 0; i < waiting_; ++i) {
::ReleaseSemaphore(sem1_, 1, NULL);
while(waiting_ > 0) {
--waiting_;
::WaitForSingleObject(sem2_, INFINITE);
}
::ReleaseSemaphore(sem1_, waiting_, NULL);
while(waiting_ > 0) {
--waiting_;
::WaitForSingleObject(sem2_, INFINITE);
}
wait_mtx_.Unlock();
}
Expand Down

0 comments on commit 8487468

Please sign in to comment.