{"id":6733,"date":"2012-12-24T14:38:48","date_gmt":"2012-12-24T19:38:48","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=6733"},"modified":"2012-12-24T14:38:49","modified_gmt":"2012-12-24T19:38:49","slug":"mainthreadonly-properties","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2012\/12\/24\/mainthreadonly-properties\/","title":{"rendered":"mainthreadonly Properties"},"content":{"rendered":"<p><a href=\"http:\/\/tewha.net\/2012\/12\/objective-c-property-proposal-mainthreadonly\/\">Steven Fisher<\/a> proposes a new Objective-C property attribute:<\/p>\n<blockquote cite=\"http:\/\/tewha.net\/2012\/12\/objective-c-property-proposal-mainthreadonly\/\"><p><code>mainthreadonly<\/code> would be like <code>nonatomic<\/code>. Compared to <code>nonatomic<\/code>, it also warns that the property can only be set from the main thread. <code>@synthesize<\/code> would generate a setter that is not only<code>nonatomic<\/code>, but generates an exception if called from a thread other than the main thread.<\/p><\/blockquote>\n<p>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.<\/p>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[54,71],"class_list":["post-6733","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-objective-c","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=6733"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6733\/revisions"}],"predecessor-version":[{"id":6734,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/6733\/revisions\/6734"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=6733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=6733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=6733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}