Apple documentation says that Atomic operations does not block the competing threads. But, how can it return/set whole value without blocking the competing threads. For example, when Thread 3(T3) is in the middle of getter if both thread1 and thread2 calls setter methods (since does not block competing threads both T1 and T2 are allowed to enter setter method) won't it return invalid value?
I have gone through many web-sites that explain atomicity with example. The examples use @synchronized(self) i setter and getter. Won't @synchronized() allow only single thread to execute a setter at a time blocking other threads?