CondVar::SignalAll was broken, leading to deadlocks on Windows builds.

http://code.google.com/p/leveldb/issues/detail?id=149
This commit is contained in:
JoelKatz
2013-05-16 23:01:24 -07:00
parent fee53cd0cf
commit fb7e01da41

View File

@@ -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();
}