Wednesday, 9 April 2014

What is difference between atomic and nonatomic in objective c

ATOMIC
1)One thread access the variable(static)
2)It is a thread safe
3)Its performance is very slow
4) It is a not keyword its a accessor
5)Its is default behaviour.
6)Will ensure the present process is completed by the cpu, before another process access the variable
Ex-@property(retain) UILabel *myLabel same as @property( atomic,retain) UILabel *myLabel
NON ATOMIC
1) Its not a default behaviour
2)Its not a thread safe
3)It is a not keyword its a accessor
4)Its performance is very first.
5)Multiple thread access the variable(dynamic).
Ex-@property(nonatomic, retain) UILabel *myLabel

1 comment: