Boost logo

Boost Users :

From: KLINIK Markus STD2-G (AREVA NP GmbH) (Markus.Klinik_at_[hidden])
Date: 2007-08-27 02:35:43


> Von: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] Im Auftrag von
> kaliwanagan
> Gesendet: Samstag, 25. August 2007 15:52
> An: boost-users_at_[hidden]
> Betreff: [Boost-users] boost::thread Destructor being called
> multiple times
>
> I was just curious as to why the class destructor are
> (apparently) being called multiple times. I have tried
> searching the archives to no avail (which prompted me to
> register and post to the mailinglist).
>

Boost::thread passes its function object around several times by value,
so it gets coyp-constructed and destructed several times. I had the same
problem, and used some sort of proxy-class until I realized that
boost::bind creates exactly that kind of proxy-objects. So either use
boost::bind or boost::mem_fn or std::mem_fun.

Best Regards
Markus


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net