Boost logo

Boost :

From: Lee Brown (lee_at_[hidden])
Date: 2002-01-15 23:34:21


On Tuesday 15 January 2002 10:24, you wrote:
> --- In boost_at_y..., Lee Brown <lee_at_a...> wrote:
> > O
> >
> > > > FWIW here's an old proposal of mine:
> > > >
> > > > http://groups.yahoo.com/group/boost/message/16471
> >
> > <excerpt>
> > A thread can terminate itself by throwing
> > an exception of type "thread_end" or a type derived from thread_end.
> > </excerpt>
> >
> > Or it can just terminate and release all resources that it has a
>
> hold of.
>
> Which fails to call destructors, which is simply not acceptable.
>
> Bill Kempf

Why is this so unacceptable? Whenever a resource is allocated, in
 a constructor or whatever.

Where is the flaw in the following? I must be missing something here.

class Lock {
 Lock(mutex& m) : m_(m) {
          disable_cancel();
          m_.lock();
          push_cleanup(m_ , &muxtex::unlock)
          enable_cancel();
 }

 ~Lock() {
        disable_cancel();
        pop_cleanup();
        enable_cancel();
   }

BTW: I was able to get a templated version of thread.start to work.
Did you avoid this for any reason?

private:
   mutex& m_;
};

>
> Info: http://www.boost.org Send unsubscribe requests to:
> <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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