commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: [pool] faulty change of synchronization? - Re: cvs commit: jakarta-commons/pool/src/java/org/apache/commons/pool/impl
Date Wed, 13 Aug 2003 19:07:37 GMT
The pool manipulation was synchronized, only the isEmpty() test is not.
I didn't realize that _numActive++ should be synchronized, I thought the 
++ operator was atomic.
I'll put these also in a synchronized block.

How does this new version looks?


John McNally wrote:

>My quick read of this change is not favorable.  It looks like changes to
>an unsynchronized list have been moved outside any synchronization. 
>Also integer math like numActive++ outside a synchronization block has
>got me into problems in the past.  A test with two threads using i++ and
>i-- ran quite some time (couple hours) on a single processor box, but
>did eventually fail.  Then the test was run on a dual processor box, it
>failed pretty much immediately, repeatedly.
>I'm -1 on this change.
>john mcnally

View raw message