Skip to content

Commit 8487468

Browse files
Vladimir Makhnychevsipa
Vladimir Makhnychev
authored andcommitted
CondVar::SignalAll was broken, leading to deadlocks on Windows builds.
http://code.google.com/p/leveldb/issues/detail?id=149
1 parent f6d84d1 commit 8487468

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

port/port_win.cc

+4-6
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,10 @@ void CondVar::Signal() {
109109

110110
void CondVar::SignalAll() {
111111
wait_mtx_.Lock();
112-
for(long i = 0; i < waiting_; ++i) {
113-
::ReleaseSemaphore(sem1_, 1, NULL);
114-
while(waiting_ > 0) {
115-
--waiting_;
116-
::WaitForSingleObject(sem2_, INFINITE);
117-
}
112+
::ReleaseSemaphore(sem1_, waiting_, NULL);
113+
while(waiting_ > 0) {
114+
--waiting_;
115+
::WaitForSingleObject(sem2_, INFINITE);
118116
}
119117
wait_mtx_.Unlock();
120118
}

0 commit comments

Comments
 (0)