I had code similar to the following...

Functor object:

struct Task
{
 operator()() { // thread main }
 smartfd p;
};

Note that smartfd is a wrapper around a file descriptor. In its dtor it closes the fd.

Then, elsewhere I set up an instance of Task and spawn it with boost::thread...

Task t;
t.p = // open file descriptor

boost::thread thr(t);

The spawned thread gets an instance of Task, but it's not the same instance as from the main.

What is the rationale?

--
Chris Cleeland