09-03-2011, 12:55 AM #1
What does nonatomic and retain do in Objective-C?
- Member Since
- Feb 21, 2011
- Macbook Air 11", 64 GB, Intel core i5, 1.6 GHz, OSX Lion 10.7
In objective-c when we apply synthesize accessor method or when we write property, we also use 2 terms, they are: nonatomic and retain. the syntax is given below:
I would like to know what exactly nonatomic and retain do.
09-05-2011, 07:36 AM #2
- Member Since
- Jun 25, 2005
- On the road
- 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Both are discussed here in The Objective-C Programming Language. Search that document for those two words.
The nonatomic directive means no locking of the variable is done during access. This speeds up access. In a multithreading scenario that could be a bad thing.
The retain directive means that upon assignment, the object will be retained. If you override the properties setter method, I believe you are then responsible for the retain.CameraTime - Time lapse photography for novice and advanced users.
When asking questions, post the version of your software. You'll receive better answers.
Please post your results to the thread as it is good feedback.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By santinir in forum OS X - Operating SystemReplies: 0Last Post: 12-15-2014, 02:46 AM
By oli271 in forum OS X - Operating SystemReplies: 6Last Post: 04-16-2010, 03:53 PM
By Coaster75 in forum Movies and VideoReplies: 2Last Post: 03-30-2010, 10:30 AM
By Isidore in forum OS X - Operating SystemReplies: 3Last Post: 10-25-2009, 11:44 AM
By BlzBub in forum OS X - Operating SystemReplies: 2Last Post: 01-26-2009, 12:46 PM