On 21 January 2011 03:59, Caldarale, Charles R
<chuck.caldar...@unisys.com> wrote:
>> From: maxxe...@gmail.com [mailto:maxxe...@gmail.com]
>> Subject: bug in TC6 ContainerBase class?
>
>> In TC6 catalina core, ContainerBase class defines this field to stop
>> the background processor thread:
>>
>>      private boolean threadDone = false;
>>
>> Shouldn't it be a volatile?
>
> In theory, the field should be marked volatile.  In practice, it won't make 
> any difference, since the method calls will force a reload of the value upon 
> return and the compiler must assume that the value could have changed.

Huh? What method calls will force a reload? Why must the compiler
assume it has changed? Surely that is what volatile is for?

threadStart() is OK, because it sets threadDone before starting the
thread, and a thread start acts as a memory barrier.

> The worst that could happen is that the thread never sees threadDone as true, 
> and thus would never terminate

Or it would take a while to be published to the other thread.

> but, to my knowledge, there's never been any instances of that reported.

But if it does happen, it will be a nuisance for all, so why not fix it now?

>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> MATERIAL and is thus for use only by the intended recipient. If you received 
> this in error, please contact the sender and delete the e-mail and its 
> attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>

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

Reply via email to