Looks good.
You're correct that volatile isn't enough to protect the case where 2
threads finish their work at exactly the same time. They would need a
synchronized block around the decrements (the increments are executed in
the constructor by the main thread so they aren't contended, but it
couldn't hurt to have all of the counts be atomic)...
...jim
On 12/23/2015 1:55 PM, Phil Race wrote:
https://bugs.openjdk.java.net/browse/JDK-8145808
http://cr.openjdk.java.net/~prr/8145808/
I believe we have a test bug where the decrement on the
counter is being treated as atomic but it is carried out on
different threads protected only by 'volatile'.
This fix does seem likely to make the test more reliable.
Note that "numexceptions" technically has the same issue
but it does not matter as it is mainly informational but
and any number > 0 is all that ever matters.
So I left that alone.
-phil.