[Boost-bugs] [Boost C++ Libraries] #2739: shouldn't at_thread_exit work on the main thread?

Subject: [Boost-bugs] [Boost C++ Libraries] #2739: shouldn't at_thread_exit work on the main thread?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-10 16:40:21


#2739: shouldn't at_thread_exit work on the main thread?
----------------------------+-----------------------------------------------
 Reporter: viboes | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: thread
  Version: Boost 1.37.0 | Severity: Showstopper
 Keywords: at_thread_exit |
----------------------------+-----------------------------------------------
 In the following example mycallable1 is not called at exit of the main
 thread. Shouldn't at_thread_exit work on the main thread?

 {{{
 #!cpp
     #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

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2739>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC