
Thanks! But I said that the thread wont start because in other class I defined, that inherits from this "Thread" class. I implemented the abstract run() method so it just prints a line to the output: class Trash : public Thread { std::string garbage; public : Trash(std::string newString){garbage = newString;}; void run(){ std::cout << "RUNNING" << std::endl;}; } int main(int argc, char** argv) { Trash myTrash("hello"); myTrash.start(); } and whenever I run the project (using boost::thread or using boost::thread_group with the correction you provided) it wont show the output... "RUNNING". BUT, if I add m_Thread.join(); it shows that output. Any idea why? Thanks!! On Thu, Mar 4, 2010 at 1:02 PM, Igor R <boost.lists@gmail.com> wrote:
void start(){m_Thread = new boost::thread( &Thread::run, this ); }; //wont start unless I add m_Thread.join();
The thread is created and started anyway. Join() just tells the *caller* thread to wait until m_Thread finishes.
void start(){g_Thread.create_thread(&Thread::run); };
g_Thread.create_thread(boost::bind(&Thread::run, this)); _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users