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

Issue 1337943004: Add ThreadBarrier; use in GCMarker and unit test (Closed)

Created:
5 years, 3 months ago by koda
Modified:
5 years, 3 months ago
Reviewers:
Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Add ThreadBarrier; use in GCMarker and unit test Thread barrier with: * fixed (at construction) number n of participating threads {T1,T2,T3,...,Tn} * unknown number of rounds. Requirements: * there is some R such that each participating thread makes R calls to Sync() followed by its one and only call to Exit(). Guarantees: * for any two threads Ti and Tj and round number r <= R, everything done by Ti before its r'th call to Sync() happens before everything done by Tj after its r'th call to Sync(). Note: * it's not required that the thread that constructs the barrier participates. BUG= Committed: https://github.com/dart-lang/sdk/commit/17a6b944d16aeefd0e4e8374d958465f62b8d8e6

Patch Set 1 #

Patch Set 2 : Rename field. #

Patch Set 3 : Comments. #

Patch Set 4 : Rename local. #

Patch Set 5 : Add fuzz test. #

Patch Set 6 : Add usage example. #

Total comments: 4

Patch Set 7 : Fix git. #

Patch Set 8 : Fix git again. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+217 lines, -125 lines) Patch
M runtime/vm/gc_marker.h View 1 2 chunks +1 line, -9 lines 0 comments Download
M runtime/vm/gc_marker.cc View 1 2 3 4 5 6 8 chunks +12 lines, -41 lines 0 comments Download
M runtime/vm/isolate_test.cc View 3 chunks +12 lines, -75 lines 0 comments Download
M runtime/vm/random.h View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M runtime/vm/random.cc View 1 2 3 4 2 chunks +12 lines, -0 lines 0 comments Download
A runtime/vm/thread_barrier.h View 1 2 3 4 5 6 1 chunk +116 lines, -0 lines 0 comments Download
A runtime/vm/thread_barrier_test.cc View 1 2 3 4 1 chunk +59 lines, -0 lines 0 comments Download
M runtime/vm/vm_sources.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (1 generated)
koda
I can move the implementation into a .cc file later if you prefer, but I ...
5 years, 3 months ago (2015-09-11 21:28:09 UTC) #2
koda
On 2015/09/11 21:28:09, koda wrote: > I can move the implementation into a .cc file ...
5 years, 3 months ago (2015-09-14 19:34:54 UTC) #3
koda
Added usage example, PTAL.
5 years, 3 months ago (2015-09-15 20:03:04 UTC) #4
Ivan Posva
LGTMwC -Ivan https://codereview.chromium.org/1337943004/diff/100001/runtime/vm/thread_barrier.h File runtime/vm/thread_barrier.h (right): https://codereview.chromium.org/1337943004/diff/100001/runtime/vm/thread_barrier.h#newcode45 runtime/vm/thread_barrier.h:45: // guarantee for Exit(). Thanks for the ...
5 years, 3 months ago (2015-09-16 04:36:11 UTC) #5
koda
Committed patchset #8 (id:140001) manually as 17a6b944d16aeefd0e4e8374d958465f62b8d8e6 (presubmit successful).
5 years, 3 months ago (2015-09-16 19:11:52 UTC) #6
koda
5 years, 3 months ago (2015-09-16 19:12:15 UTC) #7
Message was sent while issue was closed.
https://codereview.chromium.org/1337943004/diff/100001/runtime/vm/thread_barr...
File runtime/vm/thread_barrier.h (right):

https://codereview.chromium.org/1337943004/diff/100001/runtime/vm/thread_barr...
runtime/vm/thread_barrier.h:45: // guarantee for Exit().
On 2015/09/16 04:36:11, Ivan Posva wrote:
> Thanks for the example. It makes the use a lot clearer seeing it aligned here.
> 
> Also an empty line or two before "class ThreadBarrier" would help adding a
> visual break.

Done.

https://codereview.chromium.org/1337943004/diff/100001/runtime/vm/thread_barr...
runtime/vm/thread_barrier.h:83: MonitorLocker ml(&done_monitor_);
On 2015/09/16 04:36:11, Ivan Posva wrote:
> I am wondering whether this could be achieved with a single monitor, but that
is
> a future optimization.

Acknowledged.

Powered by Google App Engine
This is Rietveld 408576698