tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r948294 - in /tomcat/tc5.5.x/trunk: ./ container/webapps/docs/ jasper/src/share/org/apache/jasper/ jasper/src/share/org/apache/jasper/compiler/ jasper/src/share/org/apache/jasper/security/ jasper/src/share/org/apache/jasper/servlet/
Date Wed, 26 May 2010 16:09:57 GMT
2010/5/26 sebb <sebbaz@gmail.com>:
>>  -    private int removed = 0;
>>  +    private volatile int removed = 0;
>
> Volatile ensures correct publication across threads, but does not
> solve the lost-update problem.
>
>>          removed++;
> The above line can suffer from a lost update as the increment is not atomic.
>

The "removed" variable is only checked whether it is zero or some
positive value. So, the actual value of the variable before the
increment operation is irrelevant.  It could be written as "removed =
1;" and assignment is atomic.

Are there any observable consequences? If they are, you may file an issue.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message