
Roland Schwarz <roland.schwarz@chello.at> writes:
2) I have tried to find out if it is possible to implement a mutex that is statically initializeable with the additional constraint that zero initialization suffices. I have provided a prototype that let me believe it really can be done. (Such a mutex has the additional benefit that you need no explicit memory management.)
boost/thread/win32/basic_timed_mutex.hpp on the thread-rewrite branch provides a win32-specific statically-initializable-with-zero mutex (that I use as the basis for boost::mutex on win32). The thing is, it does require initialization when used with non-static storage duration. If the constexpr proposal gets accepted into the C++ Standard, we won't have to worry about this in the future --- constructors that just use constant expressions can be tagged "constexpr", and used for static initialization. Anthony -- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk