Monday, December 24, 2012 [Tweets] [Favorites]

mainthreadonly Properties

Steven Fisher proposes a new Objective-C property attribute:

mainthreadonly would be like nonatomic. Compared to nonatomic, it also warns that the property can only be set from the main thread. @synthesize would generate a setter that is not onlynonatomic, but generates an exception if called from a thread other than the main thread.

Sounds good to me, although I see no reason why this sort of annotation should be limited to properties. Some other methods also must be called from the main thread.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment