[concurrency-interest] what does the term "read" from volatile mean-

Bart Jacobs bart.jacobs at cs.kuleuven.be
Thu May 25 08:27:16 EDT 2006


You should distinguish two things: 1) reading a value from a variable, 
and 2) using the value in an operation.

A "read" from a field (volatile or otherwise) means getting the value 
from that field. It doesn't matter what you do with that value 
afterwards. It's not the value that's volatile, it's the field from 
which you read it.

When you use a field dereference (i.e. an expression of the form o.f) as 
the right-hand side of an assignment, an operand of a comparison, or the 
target of a method call, the value is first read from the field and then 
the value is used in the assignment, comparison, or method call.

Best,-
Bart

Yechiel Feffer wrote:
> only assigning/comparing it (to) other variable, or, if the volatile is an
> object reference, does accessing the object via that reference a volatile
> "read" too ?
>  
> Regrds,
> Yechiel Fefer
>  
>  
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>   

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the Concurrency-interest mailing list