|
volatile long: msg#00021java.jsr.166-concurrency
A question on the use of volatile in a concurrent environment. Consider the example: public class Foo { private volatile int count; public void run() { count++; // ... do some other operations count--; } public int getCount() { return count; } } My understanding is: 1) The value returned by getCount() will never be less than zero; and 2) count will never be in a corrupted state. Does the above 2 statements still hold if count is type long instead of int ? Hanson
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CMSB 2005: Second Announcement, gdp |
|---|---|
| Next by Date: | Re: volatile long, Joe Bowbeer |
| Previous by Thread: | CMSB 2005: Second Announcement, gdp |
| Next by Thread: | Re: volatile long, Joe Bowbeer |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |