Subject: [Boost-bugs] [Boost C++ Libraries] #5013: documentation: boost::thread: pthreas_exit causes terminate()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-12-22 10:33:37
#5013: documentation: boost::thread: pthreas_exit causes terminate()
-------------------------------------------------------+--------------------
Reporter: Slava <Viatcheslav.Sysoltsev@â¦> | Owner: matias
Type: Bugs | Status: new
Milestone: To Be Determined | Component: Documentation
Version: Boost 1.36.0 | Severity: Problem
Keywords: |
-------------------------------------------------------+--------------------
boost::thread before svn revision 49969 causes the terminate() to be
called if the child thread exits with pthread_exit() on linux.
See the proof test case (environment: Boost 1.36, gcc 4.3.2, openSUSE
11.1, x86_64 architecture.):
{{{
#include <boost/thread.hpp>
void tf()
{
pthread_exit(NULL);
}
int main()
{
boost::thread t(tf);
t.join();
return 0;
}
> g++ -g -O0 test2.cpp -lboost_thread && gdb a.outGNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/vsysolts/test/boost_thread/a.out...done.
(gdb) r
Starting program: /home/vsysolts/test/boost_thread/a.out
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff6cd5950 (LWP 14284)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6cd5950 (LWP 14284)]
0x00007ffff798a565 in __gnu_cxx::__verbose_terminate_handler() () from
/usr/lib64/libstdc++.so.6
(gdb) bt
#0 0x00007ffff798a565 in __gnu_cxx::__verbose_terminate_handler() () from
/usr/lib64/libstdc++.so.6
#1 0x00007ffff7988a46 in ?? () from /usr/lib64/libstdc++.so.6
#2 0x00007ffff7988a73 in std::terminate() () from
/usr/lib64/libstdc++.so.6
#3 0x00007ffff7bd898a in thread_proxy () from
/usr/lib64/libboost_thread.so.1.36.0
#4 0x00007ffff6cdd070 in start_thread () from /lib64/libpthread.so.0
#5 0x00007ffff71ce11d in clone () from /lib64/libc.so.6
#6 0x0000000000000000 in ?? ()
}}}
pthread_exit implementation uses the special forced_unwind exception to
unwind the stack, which is (wrongly) caught in boost:thread code and used
as a reason to call terminate(). The misbehaviour is commented out since
svn rev 49969.
Due to the fact the pthread_exit is quite legal possibility to end the
single thread, the fact of incompatibility with former boost:thread
implementation should be mentionen in the documentation of the boost
releases up to veriosn 1.37 (presumably). I would add the mention about
pthread_exit in the files doc/html/thread/thread_management.html, chapter
"Exceptions in thread functions".
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5013> 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:05 UTC