如何在對象內啓動線程?例如,C++ boost ::線程,如何啓動線程內的線程
class ABC
{
public:
void Start();
double x;
boost::thread m_thread;
};
ABC abc;
... do something here ...
... how can I start the thread with Start() function?, ...
... e.g., abc.m_thread = boost::thread(&abc.Start()); ...
這樣,以後我可以這樣做,
abc.thread.interrupt();
abc.thread.join();
感謝。
謝謝蓋伊,它工作得很好。 – 2607 2012-02-26 23:50:26