[concurrency-interest] maximum number of shared lock forReentrantReadWriteLock

Joe Bowbeer joe.bowbeer at gmail.com
Thu Jul 7 13:51:37 EDT 2005

FWIW, I also think the test is wrong.

This could be fixed to test for unsigned overflow, e.g., by ANDing
with 0xFFFFFFFFL, but I suspect there are other places in the code
where it is assumed that the acquire count is <= 0x7FFF.

As it stands, 32767 is the max acquire count.

On 7/7/05, Tim Peierls <tim at peierls.net> wrote:
> Tim Peierls wrote:
> >> If acquires is 0x7FFF, then that's the maximum of 65535 that Tim
> >> mentioned below, so throwing an exception is correct in this case.
> >
> > 0x7FFF is 32767 -- now I think Jinsong Hu is right. You get an overflow
> > exception when acquiring the 32768th read lock.
> And if so, this is either a doc bug or code bug. As a doc bug it could be
> fixed by changing 65536 to 32767. As a code bug it could be fixed by
> changing the overflow test.
> But maybe this has already been caught and fixed?
> --tim

More information about the Concurrency-interest mailing list