On Jul 7, 12:20 pm, Al Sutton <[email protected]> wrote:
> Try using the java keyword "volatile" in you variable declaration.

"Volatile" doesn't matter for interpreted Dalvik on a uniprocessor.
The interpreter always executes all field access instructions and
doesn't do any reordering, so "volatile" is effectively a no-op.  (In
fact, the <= Froyo interpreter ignores it completely, though this is a
bug for 64-bit values.)  It's definitely a good idea to specify it for
fields that are accessed without synchronization from multiple
threads, since the JIT might otherwise do things you didn't want it
to.

OP: There is no thread-local caching of values.  Fields are stored in
the object, so this shouldn't happen unless you have two copies of the
object or your log statements are somehow happening out of order
(logging the object's "identity hash code" can help with the first,
inserting some sleep calls could help sort out the second).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to