32 "Attempted to start working thread "
33 "when it is already running!");
38 auto rc = pthread_setname_np(handle, name.c_str());
41 s <<
"The name " << name <<
" provided for the thread is too long.";
51 "Attempted to stop working thread "
52 "when it is not running!");
59 }
catch (std::system_error
const& e) {
60 throw ThreadingIssue(
ERS_HERE, std::string(
"Error while joining thread, ") + e.what());
63 throw ThreadingIssue(
ERS_HERE,
"Thread not in joinable state during working thread stop!");
std::unique_ptr< std::jthread > m_working_thread
void stop_working_thread()
Stop the working thread.
void start_working_thread(const std::string &name="noname")
Start the working thread (which executes the do_work() function).
std::atomic< bool > m_thread_running
bool thread_running() const
Determine if the thread is currently running.
std::function< void(std::atomic< bool > &)> m_do_work
WorkerThread(std::function< void(std::atomic< bool > &)> do_work)
WorkerThread Constructor.
void warning(const Issue &issue)