[thread] shouldn't at_thread_exit work on the main thread?

Hi, in the following example mycallable1 is not called at exit of the main thread. Shouldn't at_thread_exit work on the main thread? What is wrong? Best, Vicente #include <boost/thread.hpp> #include <iostream> struct mycallable1 { void operator()() const { std::cout << "mycallable1" << std::endl; }; }; struct mycallable2 { void operator()() const { std::cout << "mycallable2" << std::endl; }; }; void my_thread() { std::cout << "my_thread" << std::endl; mycallable1 x; boost::this_thread::at_thread_exit(x); } int main() { mycallable2 x; boost::this_thread::at_thread_exit(x); boost::thread th(my_thread); th.join(); return 0; } Output: my_thread mycallable1 EXIT STATUS: 0
participants (1)
-
vicente.botet