16 Sep
2002
16 Sep
'02
5:58 p.m.
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.