Help to design a thread server for boost::thread_group seems useless
It seems that thread_group doesn't perform any task after the thread termination (see http://thread.gmane.org/gmane.comp.lib.boost.user/5694), and then doesn't manage the memory. So the following code : ------------------------- CODE --------------------------- BEGIN ----------------------- #include #include class Toto { public: Toto(){std::cout << "I'm builded\n";} Toto(const Toto&){std::cout << "I'm builded\n";} void operator() () {std::cout << "I'm called\n";} ~Toto(){std::cout << "I'm destructed\n";} }; int main(int, char **) { boost::thread_group thread; while (true) { thread.create_thread(Toto()); sleep(1); } thread.join_all(); return EXIT_SUCCESS; } ------------------------- CODE --------------------------- END ----------------------- consumes endlessly a finite memory. How can I do in order to free the memory after the thread termination ? I can't use the join/join_all for at the same time I may need to create other threads (e.g. a tcp socket server), and I can't know if a thread is running or not (there is no such methods in the thread class, http://www.boost.org/doc/html/boost/thread.html). _________________________________________________________________ Microsoft vous recommande de mettre à jour Internet Explorer. http://specials.fr.msn.com/IE7P25
participants (1)
-
lemmel lemmel