[concurrency-interest] ForkJoinPool.ManagedBlocker examples

Alex Miller alex at puredanger.com
Tue Feb 22 17:27:58 EST 2011


>From looking at the source, it does appear that the ManagedBlocker
instance .  One of the things that made me ask the question was the
example below it that uses volatile for item but I guess that is just
to support getItem(), right?  I guess I now think the examples are
correct but it would be helpful to add a note in the docs that block()
and isReleasable() will only be called from the thread that invokes
managedBlock().

A separate question, why are the ForkJoin classes no longer in a
forkjoin sub-package and just mixed into java.util.concurrent?  Seems
weird.



On Tue, Feb 22, 2011 at 3:39 PM, Jed Wesley-Smith
<jwesleysmith at atlassian.com> wrote:
> On 23/02/2011, at 3:37 AM, Alex Miller wrote:
>
>> Also, in the ReentrantLock example, I note that hasLock is not
>> volatile which I found surprising.  Is the example wrong or is there
>> really no visibility issue there?
>
> Does it make sense at all? Isn't hasLock a thread-local property anyway? That property only seems to make sense if the ManagedLocker is local to a single thread, as hasLock can't transfer between them meaningfully.
>
> Might need some more docs here.
>
> cheers,
> jed



More information about the Concurrency-interest mailing list