
27 Nov
2010
27 Nov
'10
5:01 p.m.
Hello, I have some problems with a thread call. I have a call with a method in that should create a thread: void myclass::mymethod( void ) { boost::thread l_thread( boost::bind( &myclass::threadrun, this ) ); l_thread.join(); <= this blocks } My threadrun method shows: void myclass:threadrun( void ) { while (m_listenerrunnging) { boost::this_thread::yield(); } } The join starts the threadrun method but it blocks the main run. I have got a class which should create only one thread (in itsself), that should run until the class is destroyed. The threadrun method reads some data at a network device in asychron calls, so the threadrun can sleep during running. How can I do this in a correct way? Thx Phil