The behavior changed in BOOST_THREAD_VERSION 3 (which is default in boost 1.77). Are you sure detach() and join() do not help? Can you provide a call stack? On 10/7/21 06:09, Alexander Carôt via Boost-users wrote:
Hi all,
I had been using an old boost system and boost thread lib for a couple of years without upgrading it since approx. 2014. With this old lib the following (simplified) code works fine on OSX:
#include "test.h"
test::test() { boost::thread::attributes attrs;
/// START TRACEROUTE THREAD #if defined(BOOST_THREAD_PLATFORM_WIN32) res = SetThreadPriority(attrs.native_handle(), THREAD_PRIORITY_NORMAL); #elif defined(BOOST_THREAD_PLATFORM_PTHREAD) pthread_attr_setschedpolicy(attrs.native_handle(), SCHED_FIFO); #endif tracerouteThread = boost::thread( attrs, boost::bind(&test::performTraceroute, this)); }
void test::performTraceroute() { cout << "START TRACEROUTE" << endl;
string exec = ""; cout << "DO FURTHER STUFF BUT THIS IS JUST A DEMO ..." << endl; cout << "THREAD OVER" << endl; }
Using the current boost 1_77 still does execute the thread but then it crashes within the destructor. Adding
tracerouteThread.join() or .detach() after launching the thread does not help either.
Can anyone help how to resolve this issue ?
Thanks a lot in advance, best
Alex
-- http://www.carot.de Email : Alexander@Carot.de Tel.: +49 (0)177 5719797
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users