Use a non-pointer boost::thread and a std::atomic for the stop flag.