I use a shared flag between threads. I am really worry about the performance of updating/getting a boolean flag, whether it is volatile or Atomic?
Tell me which one is best volatile or Atomic?
-----------------------
suresh
Printable View
I use a shared flag between threads. I am really worry about the performance of updating/getting a boolean flag, whether it is volatile or Atomic?
Tell me which one is best volatile or Atomic?
-----------------------
suresh
Usually for synchronization atomic access is used. And variable declared as volatile, will have atomic access by default.
If you just need the values between threads, you might want consider using a static variable.
In any case, Official JAVA page for your atomic doubts.
[URL="http://java.sun.com/docs/books/tutorial/essential/concurrency/atomic.html"]http://java.sun.com/docs/books/tutorial/essential/concurrency/atomic.html[/URL]
Cheers!
Kalayama
Thanks Kalayama...
--------------------
suresh
Hey Suresh! If you need to say Just "Thanks" press the button next to my post :D There is no poing in just posting "Thank You" anyway...
Cheers!
Kalayama