RFR: Minor changes to `StructuredTaskScope` [v2]

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


On Tue, 12 Apr 2022 13:08:10 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Paul Sandoz has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review updates.
>
> src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 273:
> 
>> 271: 
>> 272:     // the set of "tracked" Future objects waiting to be returned by Future.get, created lazily
>> 273:     // assigned once-only with FUTURES.compareAndSet, read by any thread
> 
> Instead of "assigned once-only ..." it might be simpler to just link to the track method

Changed to "    // assigned to non-null value in method track, read by any thread"

> src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/StructuredTaskScope.java line 349:
> 
>> 347:     private void track(Future<?> future) {
>> 348:         // create the set of Futures if not already created
>> 349:         // cannot use double-checked locking since it requires use of a synchronized block
> 
> I'd prefer to leave this comment as is, only because mentioning another possible implementation might confuse reader.

Ok, removed. When/if monitors are supported properly in loom we can use double checked locking, which is more idiomatic. Hard to track these things.

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

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


More information about the loom-dev mailing list