[concurrency-interest] ForkJoin updates
Alex Lam S.L.
alexlamsl at gmail.com
Sun Mar 4 14:50:30 EST 2012
On Sun, Mar 4, 2012 at 4:07 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 01/25/12 20:06, Doug Lea wrote:
>> As promised for a while now, some updates to ForkJoin
>> are available from the usual places linked from
>> 3. One small API addition: Explicit support for task marking.
>> It was cruel to tell people that they could use FJ for things
>> like graph traversal but not have a simple way to mark tasks
>> so they won't be revisited while processing a graph (among a few
>> other common use cases).
> ... and almost equally cruel to only allow a single kind of mark.
> These have been changed to methods that operate on any "short" tag,
> which allows marking with different flavors, marking multiple subtasks,
> etc. The use of "short" here is enough to support a much broader
> range of uses. The methods are a little annoying to use though because
> there are no "short" literals, so you have to say for example:
> if (task.compareAndSetForkJoinTaskTag((short)0, (short)1)) ...
> to conditionally add a simple mark.
> (No, we can't support the nicer-to-use "int" without hurting other
> FJ usages.)
Would you mind elaborate more on this? Is this something to do with
the 2-byte overhead being too significantly when the number of tasks
More information about the Concurrency-interest