Boost logo

Boost Users :

From: Juan Ramírez (jramirez.uy_at_[hidden])
Date: 2021-10-07 19:06:18


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_at_[hidden]
> Tel.: +49 (0)177 5719797
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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