Boost logo

Boost Users :

From: Mark Sizer (boost_at_[hidden])
Date: 2003-10-02 14:53:54

Huck finn wrote:

> Hi there, still a newbie question for you guys...


> 1- I'm wondering why the destructor of my FakeClass is called 4 times
> for each items ???
> 2- It says in the doc that the function that creates a thread "copies
> the function wrapped by threadfunc" and threadfunc would be in this case
> item1 and item2, does this means that the copy constructor is called
> every time a thread is created with an object?
> Thanks all!
> Simon

Try adding this add running it again:

FakeClass( const FakeClass& rkToCopy ) :
  ID( rkToCopy.ID )
  boost::mutex::scoped_lock scoped_lock(io_mutex);
  std::cout<<"FakeClass #"<<ID<<" says : "<<"Being Copied!!"<<std::endl;

It should make the answer clear.

- Mark

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at