what does the term "read" from volatile mean-

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

what does the term "read" from volatile mean-

Yechiel Feffer
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
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: what does the term "read" from volatile mean-

Bart Jacobs
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
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>  

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

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest