Boost C++ Libraries: Ticket #81: AIX 4.3 SIGSEGV at thread termination https://svn.boost.org/trac10/ticket/81 <pre class="wiki">Under AIX 4.3 / gcc 2.95.3 the threads library gets a segmentation fault when a thread terminates. This error seems to be related to the parameter that's supplied to the thread consturctor. If the parameter is a functor, a segmentation fault occurs. If the parameter is the address of a function, the threads terminate normally. For example the tennis program, which pass a thread_adapter function object to the thread constructor, gets a segmentation fault. Here's the last few lines of its output. PLAYER-A: Play. PLAYER-B: Play. PLAYER-A: Play. PLAYER-B: Play. PLAYER-A: Play. PLAYER-B: Play. PLAYER-A: Play. ---Noise OFF... PLAYER-B: Gone. PLAYER-A: Gone. Segmentation fault (core dumped) (/home/swansond/Boost)$ In contrast the exemple program from the condition variable documentation, which passes the address of a function to the thread constructor, works fine. Here's the last few lines of its output. sent: 96 sent: 97 received: 96 received: 97 sent: 98 sent: 99 received: 98 received: 99 received: -1 (/home/swansond/Boost)$ To further characterize this problem, I wrote two small programs, one that passes a functor and one that passes the address of a global function, but otherwise these two programs do the same (trivial) thing. The former fails while the latter runs normally. I enclose both programs. --- Uses functor and gets segmentation fault #include &lt;iostream&gt; #include &lt;cstddef&gt; #include &lt;cstdlib&gt; #include &lt;cassert&gt; #include &lt;boost/thread/thread.hpp&gt; #include &lt;boost/thread/mutex.hpp&gt; typedef boost::mutex::scoped_lock Lock; typedef boost::mutex Mutex; class Functor { public: Functor(Mutex&amp; m, int instance) : m_mutex(m), m_instance(instance) {} void operator()(); virtual ~Functor(){} private: Mutex&amp; m_mutex; int m_instance; }; void Functor::operator()() { for (int i=0; i&lt;10; i++) { { Lock lck(m_mutex); std::cout &lt;&lt; "Thread" &lt;&lt; m_instance &lt;&lt; " says hello!" &lt;&lt; std::endl; } boost::thread::yield(); } } int main() { Mutex mtx; Functor one(mtx, 1); Functor two(mtx, 2); boost::thread thrd1(one); boost::thread thrd2(two); thrd1.join(); thrd2.join(); return EXIT_SUCCESS; } --- Uses addres of global function and terminates normally #include &lt;iostream&gt; #include &lt;cstddef&gt; #include &lt;cstdlib&gt; #include &lt;cassert&gt; #include &lt;boost/thread/thread.hpp&gt; #include &lt;boost/thread/mutex.hpp&gt; typedef boost::mutex::scoped_lock Lock; typedef boost::mutex Mutex; Mutex m_mutex; void one() { for (int i=0; i&lt;10; i++) { { Lock lck(m_mutex); std::cout &lt;&lt; "Thread1 says hello!" &lt;&lt; std::endl; } boost::thread::yield(); } } void two() { for (int i=0; i&lt;10; i++) { { Lock lck(m_mutex); std::cout &lt;&lt; "Thread2 says hello!" &lt;&lt; std::endl; } boost::thread::yield(); } } int main() { Mutex mtx; boost::thread thrd1(&amp;one); boost::thread thrd2(&amp;two); thrd1.join(); thrd2.join(); return EXIT_SUCCESS; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/81 Trac 1.4.3 Roland Schwarz Fri, 14 Apr 2006 14:57:25 GMT status changed https://svn.boost.org/trac10/ticket/81#comment:1 https://svn.boost.org/trac10/ticket/81#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=541730 This is a dated bug report. I tried to run this on linux i386, boost RC_1_34 sucessfully (no segfault). I could not observe the problem. I also could not contact the submitter to ask if this bug still applies. If anyone still see a problem, please reopen the bug. </pre> Ticket