{"id":10791,"date":"2015-03-11T11:28:05","date_gmt":"2015-03-11T15:28:05","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10791"},"modified":"2015-03-11T11:38:40","modified_gmt":"2015-03-11T15:38:40","slug":"lets-build-synchronized","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/03\/11\/lets-build-synchronized\/","title":{"rendered":"Let&rsquo;s Build @synchronized"},"content":{"rendered":"<p><a href=\"https:\/\/www.mikeash.com\/pyblog\/friday-qa-2015-02-20-lets-build-synchronized.html\">Mike Ash<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.mikeash.com\/pyblog\/friday-qa-2015-02-20-lets-build-synchronized.html\">\n<p>Apple&rsquo;s implementation of <code>@synchronized<\/code> is available as part of the Objective-C runtime source distribution. This specific bit is available <a href=\"http:\/\/www.opensource.apple.com\/source\/objc4\/objc4-646\/runtime\/objc-sync.mm\">here<\/a>.<\/p>\n<p>It&rsquo;s build for speed rather than simplicity as the above toy implementation is. It&rsquo;s interesting to see what it does the same and what it does differently.<\/p>\n<p>The basic concept is the same. There&rsquo;s a global table that maps object pointers to locks, and the lock is then locked and unlocked around the <code>@synchronized<\/code> block.<\/p>\n<\/blockquote>\n<p>I love reading about Apple&rsquo;s runtime optimization techniques.<\/p>","protected":false},"excerpt":{"rendered":"<p>Mike Ash: Apple&rsquo;s implementation of @synchronized is available as part of the Objective-C runtime source distribution. This specific bit is available here. It&rsquo;s build for speed rather than simplicity as the above toy implementation is. It&rsquo;s interesting to see what it does the same and what it does differently. The basic concept is the same. [&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":[800,31,30,54,760,138,71],"class_list":["post-10791","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-concurrency","tag-ios","tag-mac","tag-objective-c","tag-objective-c-runtime","tag-optimization","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10791","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=10791"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10791\/revisions"}],"predecessor-version":[{"id":10797,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10791\/revisions\/10797"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}