Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Issue 24158005: Fix WaitableEvent and ConditionVariable::TimedWait to use monotonic time on non-mac posix (Closed)

Created:
7 years, 3 months ago by piman
Modified:
7 years, 2 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org
Visibility:
Public.

Description

Fix WaitableEvent and ConditionVariable::TimedWait to use monotonic time on non-Mac non-NaCl posix Both use a relative time, and it's important that this relative time is consistent with the wall clock when the system time gets adjusted (e.g. NTP, tlsdate, etc.). The monotonic clock, when available, has that property. Unfortunately, by default, pthread_cond_timedwait takes the system time which doesn't have that property. On Linux/Chrome OS, we use pthread_condattr_setclock which lets us use the monotonic clock. On Android, we use the non-portable pthread_cond_timedwait_monotonic_np which has the same effect. Unfortunately, neither is supported by NaCl. Mac can use the non-portable pthread_cond_timedwait_relative_np which uses a relative time. BUG=293736 R=thakis@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=226378

Patch Set 1 #

Patch Set 2 : fix android #

Patch Set 3 : fix_nacl #

Patch Set 4 : really fix nacl #

Patch Set 5 : add test #

Total comments: 1

Patch Set 6 : rebase #

Patch Set 7 : fix mac #

Total comments: 2

Patch Set 8 : Add NaCl comment #

Patch Set 9 : rebase #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+107 lines, -14 lines) Patch
M base/synchronization/condition_variable_posix.cc View 1 2 3 4 5 6 7 2 chunks +52 lines, -12 lines 0 comments Download
M base/synchronization/condition_variable_unittest.cc View 1 2 3 4 5 6 2 chunks +53 lines, -0 lines 1 comment Download
M base/synchronization/waitable_event_posix.cc View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
piman
This is an attempt at fixing this issue on some platforms. I looked around the ...
7 years, 2 months ago (2013-09-25 01:09:42 UTC) #1
Nico
That's a fun bug. https://chromiumcodereview.appspot.com/24158005/diff/17001/base/synchronization/condition_variable_posix.cc File base/synchronization/condition_variable_posix.cc (right): https://chromiumcodereview.appspot.com/24158005/diff/17001/base/synchronization/condition_variable_posix.cc#newcode88 base/synchronization/condition_variable_posix.cc:88: &condition_, user_mutex_, &abstime); I haven't ...
7 years, 2 months ago (2013-10-01 21:20:42 UTC) #2
Nico
n Tue, Oct 1, 2013 at 2:20 PM, <thakis@chromium.org> wrote: > That's a fun bug. ...
7 years, 2 months ago (2013-10-01 21:32:45 UTC) #3
piman
On Tue, Oct 1, 2013 at 2:32 PM, Nico Weber <thakis@chromium.org> wrote: > n Tue, ...
7 years, 2 months ago (2013-10-01 21:40:07 UTC) #4
piman
fix mac
7 years, 2 months ago (2013-10-01 21:55:26 UTC) #5
piman
PTAL with the mac fix.
7 years, 2 months ago (2013-10-01 22:41:03 UTC) #6
Nico
lgtm, thanks! Having a DISABLED_ test for this isn't ideal, but I can't think of ...
7 years, 2 months ago (2013-10-01 23:01:53 UTC) #7
piman
https://chromiumcodereview.appspot.com/24158005/diff/32001/base/synchronization/condition_variable_posix.cc File base/synchronization/condition_variable_posix.cc (right): https://chromiumcodereview.appspot.com/24158005/diff/32001/base/synchronization/condition_variable_posix.cc#newcode77 base/synchronization/condition_variable_posix.cc:77: #if defined(OS_NACL) On 2013/10/01 23:01:53, Nico wrote: > Maybe ...
7 years, 2 months ago (2013-10-01 23:16:33 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/piman@chromium.org/24158005/43001
7 years, 2 months ago (2013-10-01 23:17:48 UTC) #9
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 2 months ago (2013-10-02 00:30:11 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/piman@chromium.org/24158005/69001
7 years, 2 months ago (2013-10-02 01:18:47 UTC) #11
piman
Committed patchset #9 manually as r226378 (presubmit successful).
7 years, 2 months ago (2013-10-02 01:25:34 UTC) #12
Alexander Potapenko
https://codereview.chromium.org/24158005/diff/69001/base/synchronization/condition_variable_unittest.cc File base/synchronization/condition_variable_unittest.cc (right): https://codereview.chromium.org/24158005/diff/69001/base/synchronization/condition_variable_unittest.cc#newcode209 base/synchronization/condition_variable_unittest.cc:209: TEST_F(ConditionVariableTest, DISABLED_TimeoutAcrossSetTimeOfDay) { A disabled test will rot in ...
7 years, 2 months ago (2013-10-03 09:16:17 UTC) #13
piman
7 years, 2 months ago (2013-10-03 18:28:16 UTC) #14
Message was sent while issue was closed.
On 2013/10/03 09:16:17, Alexander Potapenko wrote:
>
https://codereview.chromium.org/24158005/diff/69001/base/synchronization/cond...
> File base/synchronization/condition_variable_unittest.cc (right):
> 
>
https://codereview.chromium.org/24158005/diff/69001/base/synchronization/cond...
> base/synchronization/condition_variable_unittest.cc:209:
> TEST_F(ConditionVariableTest, DISABLED_TimeoutAcrossSetTimeOfDay) {
> A disabled test will rot in no time, because nobody is going to run it.
> Also, the comment references a bug which is already marked as fixed and which
> doesn't contain any details relevant to this test.

ideas welcome.

Powered by Google App Engine
This is Rietveld 408576698