Boost logo

Boost Users :

From: Alexander Carôt (alexander_carot_at_[hidden])
Date: 2021-10-07 09:09:16


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 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