Boost logo

Threads-Devel :

From: Matt Hurd (matt.hurd_at_[hidden])
Date: 2006-03-06 06:00:49


On Monday 06 March 2006 22:02, Roland Schwarz wrote:
> Matt Hurd wrote:
> >To avoid the errors in writing portable code I discussed before. Making a
> >recursive mutex the default makes a large class of portability errors go
> >away.
>
> Sorry, I disagree. Windows does not have the concept of condition
> variables, but pthreads has. Recursive mutex behaviour is potentially
> dangerous when used with a condition variable. So this might explain
> why windows has recursive per default.
> And if you are using recursive mutex together with condition variables
> you can detected inappropriate usage only during runtime.

Not if you take my later suggestion of requiring the mutex type to be embedded
within the condition var as there is usually only a specific mutex that will
work with the condvar.

e.g.
  boost::condition::mutex

This prevents the problem of using the wrong mutex type.

Your thoughts?

matt.


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk