Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2739: shouldn't at_thread_exit work on the main thread?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-09 08:51:01
#2739: shouldn't at_thread_exit work on the main thread?
---------------------------+------------------------------------------------
Reporter: viboes | Owner: anthonyw
Type: Bugs | Status: closed
Milestone: Boost 1.40.0 | Component: thread
Version: Boost 1.37.0 | Severity: Problem
Resolution: wontfix | Keywords: at_thread_exit
---------------------------+------------------------------------------------
Changes (by anthonyw):
* status: new => closed
* resolution: => wontfix
Comment:
No, at_thread_exit should not work on the main thread.
If you call exit() then all threads are abruptly terminated without
calling their exit handlers.
Returning from main is defined to be equivalent to calling exit(), so all
threads (including the main thread) are terminated without calling exit
handlers.
On POSIX, if you exit the main thread by calling pthread_exit() then the
thread exit handlers should run. Similarly, on Windows you can use
ExitThread(). However, I would recommend using atexit or explicit calls,
or even just normal destructors, since using pthread_exit() or ExitThread
will not run destructors for automatic_objects.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2739#comment:6> 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:50:03 UTC