ios - Why nonatomic is still used even though it might cause data error? -


this question has answer here:

i've read through several explanation on differences between atomic , nonatomic. in this link, says:

with "atomic", synthesized setter/getter ensure whole value returned getter or set setter, regardless of setter activity on other thread. is, if thread in middle of getter while thread b calls setter, actual viable value -- autoreleased object, -- returned caller in a.

in nonatomic, no such guarantees made. thus, nonatomic considerably faster "atomic".

nonatomic qualifier may cause access error when using setter , getter @ same time. what's point of using it, although it's faster atomic?

performance. if declare properties atomic, accessors use locks ensure values retrieved , set. if don't need - sure 1 thread have access variable , you're incurring performance penalty locks without getting benefit. it's decide need lock on object or not.


Comments

Popular posts from this blog

Sass watch command compiles .scss files before full sftp upload -

filehandler - java open files not cleaned, even when the process is killed -

gridview - Yii2 DataPorivider $totalSum for a column -