That article provides a neat introduction to using the volatile keyword, but
nowhere does it mention IOException and the first pattern it lists (a very
common one, directly relating to the OP's question) explicitly does not
require synchronization.

If Android didn't follow the memory model prescribed in the JLS a lot of
well established Java code might become unsafe; based on the OP's
description, a volatile boolean is definitely adequate. If in doubt, see
what the platform code does, eg:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=awt/java/awt/EventDispatchThread.java

Tom.

On 18 October 2010 23:27, Bret Foreman <[email protected]> wrote:

> http://www.ibm.com/developerworks/java/library/j-jtp06197.html
>
> I'll stick with IBM's opinion. Note that they explicitly use a boolean
> as an example.
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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