| Index: base/synchronization/waitable_event_posix.cc
|
| diff --git a/base/synchronization/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc
|
| index a8b686b88ce8ff583f68daad2c37e63efe1b1c67..c1d269cbde8209f5983534dc792d77429984ed10 100644
|
| --- a/base/synchronization/waitable_event_posix.cc
|
| +++ b/base/synchronization/waitable_event_posix.cc
|
| @@ -153,17 +153,22 @@ class SyncWaiter : public WaitableEvent::Waiter {
|
| };
|
|
|
| void WaitableEvent::Wait() {
|
| - bool result = TimedWait(TimeDelta::FromSeconds(-1));
|
| + bool result = TimedWaitUntil(TimeTicks::Max());
|
| DCHECK(result) << "TimedWait() should never fail with infinite timeout";
|
| }
|
|
|
| -bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
|
| +bool WaitableEvent::TimedWait(const TimeDelta& max_delta) {
|
| + // TimeTicks takes care of overflow including the cases when max_delta
|
| + // is a maximum value.
|
| + return TimedWaitUntil(TimeTicks::Now() + max_delta);
|
| +}
|
| +
|
| +bool WaitableEvent::TimedWaitUntil(const TimeTicks& end_time) {
|
| // Record the event that this thread is blocking upon (for hang diagnosis).
|
| base::debug::ScopedEventWaitActivity event_activity(this);
|
|
|
| base::ThreadRestrictions::AssertWaitAllowed();
|
| - const TimeTicks end_time(TimeTicks::Now() + max_time);
|
| - const bool finite_time = max_time.ToInternalValue() >= 0;
|
| + const bool finite_time = !end_time.is_max();
|
|
|
| kernel_->lock_.Acquire();
|
| if (kernel_->signaled_) {
|
|
|