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

Issue 2187333002: Loosen/improve AtomicFlag semantics. (Closed)

Created:
4 years, 4 months ago by gab
Modified:
4 years, 4 months ago
Reviewers:
danakj, fdoray
CC:
chromium-reviews, fdoray, Lei Zhang
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Loosen/improve AtomicFlag semantics. In particular don't attach to construction thread, the requirement was I think trying to articulate that it doesn't make sense to call Set() from different threads as it's then not clear which thread IsSet() is memory consistent with. But: 1) What's required is *sequence* not *thread* checking. 2) Calls to Set() need to be sequenced w.r.t. to each other, but not with respect to construction (AtomicFlag is not modified before Set()). Update restrictions to reflect that and update comments to reflect the guarantees provided by them + its usage of atomics/barriers. Also expose UnsafeReset() outside of "testing", it will be used in https://codereview.chromium.org/2135413003/. BUG=629716 Committed: https://crrev.com/d0cc00da87f2e1ccae783ad876848518b1c389f0 Cr-Commit-Position: refs/heads/master@{#409020}

Patch Set 1 #

Patch Set 2 : self-review #

Patch Set 3 : side-effects #

Total comments: 9

Patch Set 4 : =>UnsafeResetForTesting and BusyWaitUntilFlagIsSet() comment #

Patch Set 5 : fix compile post merge #

Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -16 lines) Patch
M base/synchronization/atomic_flag.h View 1 2 3 3 chunks +6 lines, -4 lines 0 comments Download
M base/synchronization/atomic_flag.cc View 1 2 3 4 1 chunk +8 lines, -2 lines 0 comments Download
M base/synchronization/atomic_flag_unittest.cc View 1 2 3 2 chunks +62 lines, -10 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 44 (29 generated)
gab
Dana PTAL, this is now a precursor to https://codereview.chromium.org/2135413003/ Thanks!
4 years, 4 months ago (2016-07-28 18:21:38 UTC) #11
danakj
I agree about the constructor, I was wondering about it in the first place :) ...
4 years, 4 months ago (2016-07-28 19:57:22 UTC) #16
gab
On 2016/07/28 19:57:22, danakj wrote: > I agree about the constructor, I was wondering about ...
4 years, 4 months ago (2016-07-28 23:39:56 UTC) #17
fdoray
https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h File base/synchronization/atomic_flag.h (right): https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h#newcode40 base/synchronization/atomic_flag.h:40: SequenceChecker set_sequence_checker_; Given that there are no guarantees about ...
4 years, 4 months ago (2016-07-29 20:41:37 UTC) #19
gab
On 2016/07/28 23:39:56, gab wrote: > On 2016/07/28 19:57:22, danakj wrote: > > I agree ...
4 years, 4 months ago (2016-08-01 15:08:30 UTC) #20
fdoray
lgtm https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h File base/synchronization/atomic_flag.h (right): https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h#newcode36 base/synchronization/atomic_flag.h:36: void UnsafeReset(); Keep ForTesting() if you no longer ...
4 years, 4 months ago (2016-08-01 16:15:51 UTC) #21
gab
On 2016/08/01 16:15:51, fdoray wrote: > lgtm > > https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h > File base/synchronization/atomic_flag.h (right): > ...
4 years, 4 months ago (2016-08-01 16:40:42 UTC) #22
danakj
https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h File base/synchronization/atomic_flag.h (right): https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h#newcode33 base/synchronization/atomic_flag.h:33: // UnsafeReset(), the AtomicFlag is safe and regains it's ...
4 years, 4 months ago (2016-08-01 17:14:57 UTC) #23
gab
Done, PTAnL, thanks! https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h File base/synchronization/atomic_flag.h (right): https://codereview.chromium.org/2187333002/diff/90001/base/synchronization/atomic_flag.h#newcode33 base/synchronization/atomic_flag.h:33: // UnsafeReset(), the AtomicFlag is safe ...
4 years, 4 months ago (2016-08-01 17:46:46 UTC) #27
gab
@thestig in Dana's absence (no pending comments remaining, merely need final stamp), thanks!
4 years, 4 months ago (2016-08-01 18:20:40 UTC) #33
danakj
OOO LGTM :)
4 years, 4 months ago (2016-08-01 18:57:32 UTC) #34
gab
On 2016/08/01 18:57:32, danakj_OOO_back_8.8 wrote: > OOO LGTM :) Thanks, Lei to CC :-)
4 years, 4 months ago (2016-08-01 19:05:19 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2187333002/150001
4 years, 4 months ago (2016-08-01 19:06:03 UTC) #40
commit-bot: I haz the power
Committed patchset #5 (id:150001)
4 years, 4 months ago (2016-08-01 19:24:21 UTC) #42
commit-bot: I haz the power
4 years, 4 months ago (2016-08-01 19:26:52 UTC) #44
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/d0cc00da87f2e1ccae783ad876848518b1c389f0
Cr-Commit-Position: refs/heads/master@{#409020}

Powered by Google App Engine
This is Rietveld 408576698