Monday, March 12, 2012 [Tweets] [Favorites]

Recursive Mutexes Considered Harmful

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 mutex instead of just doing it right?

Recursive locks were added to POSIX as a demonstration of attributes objects.

Update (2013-09-24): Brent Simmons:

David Butenhof explains, in 2005 in comp.programming.threads, why POSIX has recursive mutexes: “Because of a dare.”

Comments

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

Leave a Comment