Re: [android-developers] Should I use "synchronized" for a boolean variable

2010-10-18 Thread Daniel Drozdzewski
On Mon, Oct 18, 2010 at 10:21 AM, xeagle wrote: > Hi, > > I use a boolean variable "flag" both in main and child thread. This > "flag" is used to notify child thread to exit. I only use simple > operation, e.g., "flag=false", "if (flag) {}". As I know, in java, > "get and set a boolean variable" i

[android-developers] Should I use "synchronized" for a boolean variable

2010-10-18 Thread xeagle
Hi, I use a boolean variable "flag" both in main and child thread. This "flag" is used to notify child thread to exit. I only use simple operation, e.g., "flag=false", "if (flag) {}". As I know, in java, "get and set a boolean variable" is atomic. So "synchronized" is not needed for variable "flag