[concurrency-interest] maximum number of sharedlock forReentrantReadWriteLock

Doug Lea dl at cs.oswego.edu
Fri Jul 8 15:57:28 EDT 2005


Dawid Kurzyniec wrote:
> Doug Lea wrote:
> 
> 
>>> You get an overflow exception when acquiring the 32768th read lock.
>>>
>>
>>Yes, sorry; the specified value should have been 32767.
>>This javadoc will (hopefully) be fixed for Mustang.
>>
> 
> Wouldn't it be better to modify the implementation to use unsigned 
> arithmetic? E.g. using:
> 
> if (c<0 && nextc>=0)
> 
> as an overflow condition?
> 

Yes. Silly me. Thanks!

While I'm at it, note that this part of javadoc is in an
"implementation note", which basically means that programmers
cannot rely on the exact numerical limitation. Essentially
all count-based locks have SOME limitation. The bound for
any implementation is left as a quality-of-implementation issue.


-Doug



More information about the Concurrency-interest mailing list