From: Anthony Williams (anthony_at_[hidden])
Date: 2006-03-01 11:50:44
Matt Hurd <matt.hurd_at_[hidden]> writes:
>> Hi all,
> An additional discussion point is the recursive / non-recursive default
> I like the current boost default of a boost::mutex being the base level an
> platform supports, but this has bitten me big time in projects. Especially
> with windows developers coming to a posix platform.
> Posix, and thus linux, are non-recursive by default. Windows mutexes are
> I'm no longer so sure the boost default is such a good idea especially as the
> performance of a recursive mutex on posix on a modern platform seems
> consistent with a non-recursive one in the main...
> I think having the recursive mutex as a consisent default across platforms
> will be a good thing and protect the average user, like me, from themselves.
> Have a concept of a non-recursive mutex as a special case mutex raises an
> interesting point as on windows they don't exist, so the separate concept as
> which is the boost default remains useful.
> Any thoughts on this?
Well, OS Mutexes might be recursive on Windows, but Critical Sections
aren't. My basic_mutex isn't, for the same reason Critical Sections aren't ---
in the absence of contention, it's just a straightforward interlocked
increment, and making it recursive requires additional code --- hence my
I think that separating recursive and non-recursive mutexes is a good idea.
-- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk