Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-02-19 12:02:00


Kevin Atkinson wrote:
[...]
> > > > your Mutex class offers undefined behavior;
> > > > you really can NOT "replicate" a {pthread_mutex_t} mutex.
> > >
> > > Where do I replicate a mutex?
> >
> > "....
> > 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. ....

http://www.opengroup.org/onlinepubs/007904975/functions/pthread_mutex_init.html

"....
 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.

regards,
alexander.

--
http://groups.google.com/groups?threadm=7601581c.0210101239.5844c0f1%40posting.google.com
(Subject: PTHREAD_STATIC_INITIALIZER, class constructor)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk