On Wed, 19 Feb 2003, Kevin Atkinson wrote: > On Wed, 19 Feb 2003, Alexander Terekhov wrote: > > > Kevin Atkinson wrote: > > > > > static const pthread_mutex_t MUTEX_INIT = PTHREAD_MUTEX_INITIALIZER; > > > > > > > > class Mutex { > > > > pthread_mutex_t l_; > > > > public: > > > > Mutex() : l_(MUTEX_INIT) {}" > > > > ^^^^^^^^^^^^^^ > > > > > > I believe this behavior is well defined. .... > > ".... > > Only /mutex/ itself may be used for performing synchronization. > > The result of referring to copies of /mutex/ in calls to <snip> > > is undefined." > > > > End of story. > > You ignored the rest of my argument. Neither the right hand side or the > left hand side of the assignment involve a mutex that has ever been used > in any way by any function. It may be technically undefined by the POSIX > standard however I can not see any way that this can do any harm. I > challenge you to find an implementation in which what I did will cause a > problem, or for that matter an hypothetical implementation.
Alright after reading the standard a bit closer on the behavior PTHREAD_MUTEX_INITIALIZER. It says it can be used to statically initialize a mutex and implies it may only be used in the form of "pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER". However I do not see how: static const pthread_mutex_t MUTEX_INIT = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mutex = MUTEX_INIT. is functionally different than the form it gives. -- http://kevin.atkinson.dhs.org _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost