1

Possible Duplicate:
Objective-C properties: atomic vs nonatomic

IN regards to he @property directives and setting the attribute nonatomic versus atomic:

I do understand that you get a performance boost using the nonatomic attribute because the system does not lock the class variable to prevent from complications due to threading. Most examples and code I see in fact do use nonatomic most of the time. I think this is due to the fact that apps generally run on the main thread and don't use threads in their code. But, I would suspect that a lot of the objects and their methods under the hood are thread based and may need to be locked down if i want to retain and access them. Is this true? and if so, how would i know to lock down that object by using the @property(assign, retain) .

In other words, in what case would one find the case to use @property(assign, retain) when not writing threads in my app?

Community
  • 1
  • 1
yeahdixon
  • 6,647
  • 1
  • 41
  • 43
  • 3
    assign and retain? That doesn't make sense to me. – Dexter Nov 24 '10 at 18:20
  • 2
    possible duplicate of [Objective-C properties: atomic vs nonatomic](http://stackoverflow.com/questions/588866/objective-c-properties-atomic-vs-nonatomic) and note that `atomic` does **not** guarantee thread-safety – David Gelhar Nov 24 '10 at 18:25

0 Answers0