RFR: Minor changes to `StructuredTaskScope` [v2]

Paul Sandoz psandoz at openjdk.java.net
Tue Apr 12 16:26:32 UTC 2022


> Some suggested minor changes to `StructuredTaskScope` source while reviewing the code.
> 
> Overall I like how this approach has boiled down to about as simple as it can get while supporting the constraints of structured concurrency (thanks in no small part to `ThreadFlock`).
> 
> I think it should be possible to simplify the subclass implementations if the values of `Future.State` were comparable as in `RUNNING` < `CANCELED` < `FAILED` < `SUCCESS`. Otherwise, introducing that internally could also simplify and avoid the task scopes holding on unnecessarily to futures that are not operated on after join. I was reluctant to make such a change here but could propose as a separate PR.
> 
> I was uncertain if the `ShutdownOnSuccess.result` methods and the various exception returning/operating methods on `ShutdownOnFailure` should be constrained to throw if called before `join` has completed. Otherwise, we should specify that if operated on before `join` has completed then the results are unspecified.
> (There might be a simple way for join to return something other than `this`, thereby avoiding this issue, with some additional complexity, but I suspect you have already thought of that and took the minimal route.)
> 
> I presume there is an implicit happens-before edge on `join` that we can make explicit and specify?

Paul Sandoz has updated the pull request incrementally with one additional commit since the last revision:

  Review updates.

-------------

Changes:
  - all: https://git.openjdk.java.net/loom/pull/142/files
  - new: https://git.openjdk.java.net/loom/pull/142/files/c8921360..f0f353fa

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=loom&pr=142&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=loom&pr=142&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
  Patch: https://git.openjdk.java.net/loom/pull/142.diff
  Fetch: git fetch https://git.openjdk.java.net/loom pull/142/head:pull/142

PR: https://git.openjdk.java.net/loom/pull/142


More information about the loom-dev mailing list