Chromium Code Reviews| Index: base/synchronization/waitable_event_posix.cc |
| diff --git a/base/synchronization/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc |
| index fccba9d31c67c767b0b8172e10ad127ab2a5cb24..9eaf6b9c6c2d5d10343f17d8bcef32485aab5979 100644 |
| --- a/base/synchronization/waitable_event_posix.cc |
| +++ b/base/synchronization/waitable_event_posix.cc |
| @@ -279,7 +279,7 @@ size_t WaitableEvent::WaitMany(WaitableEvent** raw_waitables, |
| // This will store the index of the raw_waitables which fired. |
| size_t signaled_index = 0; |
| - // Take the locks of each WaitableEvent in turn (except the signaled one) and |
| + // Take the locks of each WaitableEvent in turn and |
| // remove our SyncWaiter from the wait-list |
| for (size_t i = 0; i < count; ++i) { |
| if (raw_waitables[i] != signaled_event) { |
| @@ -290,6 +290,11 @@ size_t WaitableEvent::WaitMany(WaitableEvent** raw_waitables, |
| raw_waitables[i]->kernel_->Dequeue(&sw, &sw); |
| raw_waitables[i]->kernel_->lock_.Release(); |
| } else { |
| + // We acquire and release the lock in order to ensure that the |
|
agl
2014/07/25 17:32:46
It doesn't seem reasonable that WaitMany has this
yhirano
2014/07/29 06:48:11
TimedWait has the property because it acquires the
agl
2014/07/29 21:39:49
Ah, you have found a bug in the code! TimedWait ca
yhirano
2014/07/30 11:43:45
Hmm... I can easily find multiple code relying on
|
| + // corresponding |Signal| is done at this point. |
| + raw_waitables[i]->kernel_->lock_.Acquire(); |
| + raw_waitables[i]->kernel_->lock_.Release(); |
| + |
| signaled_index = i; |
| } |
| } |