Re: Phaser.arrive() memory consistency effects
Doug Lea via Concurrency-interest <[email protected]> Sat, 30 Jan 2021 10:21:47 -0500
| Newsgroups | gmane.comp.java.jsr.166-concurrency |
|---|---|
| Message-ID | <[email protected]> |
On 1/29/21 6:05 AM, Petr Janeček via Concurrency-interest wrote: > The package JavaDoc says: >> Actions prior to calling [...] Phaser.awaitAdvance (as well as >> its variants) happen-before actions [...] subsequent to a >> successful return from the corresponding await in other threads > This is OK. > > However, I cannot find any information about the arrive() method, > or the effects of getPhase(). Because some of my threads do want > to wait while the others sometimes don't, they simply want to > publish a write (or read shared state) and move on without > waiting. > > Would you please consider specifying the memory consistency > effects of Phaser in greater detail, so that we can safely use it? Good suggestion; thanks! We can at least flesh out arrive vs advance. I don't think we can say anything further that isn't implied by this about getPhase. In particular, a call to getPhase can race with an advance. So: * * <p>Memory consistency effects: Actions prior to any form of arrive * method <a href="package-summary.html#MemoryVisibility"> * <i>happen-before</i></a> a corresponding phase advance and * onAdvance actions (if present), which in turn <i>happen-before</i> * actions following the phase advance. * _______________________________________________ Concurrency-interest mailing list [email protected] http://cs.oswego.edu/mailman/listinfo/concurrency-interest