Hello Boost Users,

I would like to implement a simple threaded class like this:

class C
{
  public:
    void Start();
    void Stop();

  private:
    bool running;
    boost::thread t;
    void ThreadJob();
}

void C::Start()
{
    running = true;
    t = boost::thread(&C::ThreadJob);
}

void C::Stop()
{
    running = false;
    t.join();
}

void C::ThreadJob()
{
    while(running);
}


However, the syntax for this line is wrong:
    t = boost::thread(&C::ThreadJob);

The only examples I can find show starting the thread at the same time it is defined! Is it possible to define the thread as a class member, and start it later? If so, what would the syntax for this line be? If not, can you suggest an alternative structure?

Thank you,

Anthony