[concurrency-interest] StampedLock

Doug Lea dl at cs.oswego.edu
Mon Oct 15 07:51:20 EDT 2012


On 10/14/12 15:45, Martin Buchholz wrote:
> In tryConvertToWriteLock:
> so the check  a < WBIT in
>
>              else if (m == RUNIT && a != 0L && a < WBIT) {
>
> can be removed.
>

Thanks!

> ---
>
> Also, it would be more consistent with other methods to throw IMSE on
> "impossible" stamps

This is a borderline case but the convention in all try- methods is that
failure tells you nothing about the state of the lock or even the stamp.
We must do this for the sake of (not yet present) full memory specs.
We must not make promises about crazy "backwards"
usages where locked means go and unlocked means stop.
See Hans's http://www.hpl.hp.com/techreports/2005/HPL-2005-217R1.html

>
> Alternatively, you could make this sharp knife...

The knife is not very sharp at all when you use it
as an internal utility in the development of thread-safe
components. But is almost never useful otherwise. I reworked
javadocs to clarify this.

-Doug




More information about the Concurrency-interest mailing list