{"id":4481,"date":"2012-03-12T21:50:53","date_gmt":"2012-03-13T02:50:53","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=4481"},"modified":"2016-06-16T09:29:59","modified_gmt":"2016-06-16T13:29:59","slug":"recursive-mutexes-considered-harmful","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2012\/03\/12\/recursive-mutexes-considered-harmful\/","title":{"rendered":"Recursive Mutexes Considered Harmful"},"content":{"rendered":"<p><a href=\"http:\/\/groups.google.com\/group\/comp.programming.threads\/msg\/d835f2f6ef8aed99?hl=en&amp;pli=1\">David Butenhof<\/a> (via <a href=\"http:\/\/news.ycombinator.com\/item?id=3692523\">Hacker News<\/a>):<\/p>\r\n<blockquote cite=\"http:\/\/groups.google.com\/group\/comp.programming.threads\/msg\/d835f2f6ef8aed99?hl=en&amp;pli=1\"><p>But nobody was supposed to use recursive mutexes. For the original \r\nintended purpose, only the global mutex would work anyway. And if you \r\ncould analyze the code paths enough to know that a separate mutex was \r\nsafe, why the heck would anyone want the overhead and complication of a \r\nrecursive mutex instead of just doing it right?<\/p><\/blockquote>\r\n<p>Recursive locks were added to POSIX as a demonstration of attributes \r\nobjects.<\/p>\r\n<p>Update (2013-09-24): <a href=\"http:\/\/inessential.com\/2013\/09\/24\/recursive_locks\">Brent Simmons<\/a>:<\/p>\r\n<blockquote cite=\"http:\/\/inessential.com\/2013\/09\/24\/recursive_locks\"><p>David Butenhof explains, in 2005 in comp.programming.threads, <a href=\"http:\/\/www.zaval.org\/resources\/library\/butenhof1.html\">why POSIX has recursive mutexes<\/a>: &ldquo;Because of a dare.&rdquo;<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>David Butenhof (via Hacker News): But nobody was supposed to use recursive mutexes. For the original intended purpose, only the global mutex would work anyway. And if you could analyze the code paths enough to know that a separate mutex was safe, why the heck would anyone want the overhead and complication of a recursive [&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":[],"class_list":["post-4481","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/4481","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=4481"}],"version-history":[{"count":4,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/4481\/revisions"}],"predecessor-version":[{"id":14810,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/4481\/revisions\/14810"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=4481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=4481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=4481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}