|
Boost Users : |
Subject: Re: [Boost-users] pthread_exit() from boost::thread segfaults
From: Viatcheslav.Sysoltsev_at_[hidden]
Date: 2010-12-21 03:46:34
>
> There is no reason for your snippet to fail. I have tested on openSUSE
> 11.3,
> 64 bits with gcc 4.5.0 and libboost_thread 1.42.
> Try to remove from the thread starter function the call to
> pthread_exit() and
> see if you still get the error.
It works well without pthread_exit(), I'm using boost about an year on
this machine unchanged, that's why this fault wonder me sooo much.
update to the issue: the prog freezes with latest boost release 1.45 in
the main thread, the child thread exits without any error:
(LD_LIBRARY_PATH is set to /home/vsysolts/boost/boost_1_45_0/stage/lib)
#include <stdio.h>
#include <boost/thread.hpp>
void tf()
{
printf("thread\n");
sleep(1);
pthread_exit(NULL);
}
int main()
{
printf("main entered\n");
boost::thread t(tf);
t.join();
printf("main exiting");
return 0;
}
vsysolts:~/test/boost_thread (0) > g++ -I/home/vsysolts/boost/boost_1_45_0
test2.cpp -L/home/vsysolts/boost/boost_1_45_0/stage/lib -lboost_thread &&
gdb a.out
GNU 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]
main entered
[New Thread 0x7ffff6cce950 (LWP 12763)]
thread
[Thread 0x7ffff6cce950 (LWP 12763) exited]
^C
Program received signal SIGINT, Interrupt.
0x00007ffff6cd9d59 in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib64/libpthread.so.0
(gdb) bt
#0 0x00007ffff6cd9d59 in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib64/libpthread.so.0
#1 0x00007ffff7bd6184 in boost::thread::join() () from
/home/vsysolts/boost/boost_1_45_0/stage/lib/libboost_thread.so.1.45.0
#2 0x0000000000402d45 in main ()
-- Slava
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net