Fix bug in EventPosix where we'd miss a set event.

In cases of timeout or error, we could change the state of the event to 'down' (unset) and subsequently never satisfy a Wait() for a given Set().

BUG=4284
R=pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/38049004

Cr-Commit-Position: refs/heads/master@{#8310}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8310 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tommi@webrtc.org 2015-02-10 09:33:28 +00:00
parent 648f5d6dc7
commit 30015e3180

View File

@ -148,10 +148,13 @@ EventTypeWrapper EventPosix::Wait(unsigned long timeout) {
}
}
if (ret_val == 0)
CHECK(state_ == kUp);
// Be careful to only change the state if we're about to report that the
// event was signaled.
if (ret_val == 0) {
DCHECK(state_ == kUp);
state_ = kDown;
}
state_ = kDown;
pthread_mutex_unlock(&mutex_);
switch (ret_val) {