Boost logo

Boost Users :

From: Huck finn (huckfinn19_at_[hidden])
Date: 2003-10-05 19:06:14


Ok, now I see that my object is being copied. But for the lines :

        FakeClass *item1 = new FakeClass(1);//,item2(2);
        group.create_thread(*item1);

I get :

FakeClass #1 says : I'm alive!
FakeClass #1 says : Being Copied!!
FakeClass #1 says : Being Copied!!
FakeClass #1 says : Being Copied!!
FakeClass #1 says : I'm being destroyed!
FakeClass #1 says : I'm being destroyed!
FakeClass #1 says : Being Copied!!
FakeClass #1 says : I'm being destroyed!
Thread for FakeClass #1 has been started!
FakeClass #1 says : I'm being destroyed!
   main ending...

The copy constructor is called 4 times!!! And it is called 3 times before
the thread has even started! Is there a way to avoid that ?

I was going to use the thread_group to manage the connection to a simple
server applications, so that all the threads would hold info about the
socket used for connection, etc... And that if the objectdestructor is
called, the connection to the socket would be closed... With my object being
destroyed 3 times before the thread has started, it gets a bit hard to
manage that way... Any clue on how to use the threads so that it would work?

thanks,

Simon

_________________________________________________________________
MSN Messenger : discutez en direct avec vos amis !
http://messenger.fr.msn.ca/


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