Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-02-19 15:24:58


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.

  struct pthread_mutex_t_ {

    /* ... */

#ifdef __cplusplus

    __copy_ctor(const pthread_mutex_t_&) {
      throw "Don't do this!";
    }

#endif

  };
  typedef struct pthread_mutex_t_ pthread_mutex_t;

regards,
alexander.


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