Re: a questions about thread-safety of boolean variables

2009-09-30 Thread Charlie Dickens
at it will stop entering the loop sometime (I don't care if there are n iterations or n+1 or even n+m) Thanks On Wed, Sep 30, 2009 at 10:44 AM, steve wrote: > Hi, > > On 09/30/2009 01:53 PM, Charlie Dickens wrote: > >> Hi, >> if I have a class A that contains a bo

a questions about thread-safety of boolean variables

2009-09-30 Thread Charlie Dickens
Hi,if I have a class A that contains a boolean variable named x, is it safe to read and change it from different threads without using locks? Is it guaranteed that A.x will be always True or False, and not any other weird value that that causes it to be inconsistent (assuming I only set it to True