Boost logo

Boost Users :

From: Luis De la Parra (lparrab_at_[hidden])
Date: 2002-09-16 12:58:45


On Monday 16 September 2002 16:50, Marcio Del'Valle wrote:
> Hi there,
>
> When I use boost::thread for creating multiple threads I notice that the
> destructor of object I pass as an argument ( boost::thread(*pObjetc) ) is
> called twice. Why does it happen?

because boost makes a copy (acutally several!!) of the object, and then
destroys them. boost calls the copy constructor to get a copy of the object
you pass as a function object, and then makes another copy (don't know why)
and then destroyes the "temporary" objects.


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