11#ifndef UTILITIES_INCLUDE_UTILITIES_REUSABLETHREAD_HPP_
12#define UTILITIES_INCLUDE_UTILITIES_REUSABLETHREAD_HPP_
16#include <condition_variable>
44 void set_name(
const std::string& name,
int tid);
53 template<
typename Function,
typename... Args>
57 m_task = std::bind(f, args...);
77 std::condition_variable
m_cv;
std::atomic< bool > m_worker_done
bool set_work(Function &&f, Args &&... args)
std::atomic< bool > m_task_assigned
std::atomic< bool > m_named
std::condition_variable m_cv
int get_thread_id() const
ReusableThread & operator=(const ReusableThread &)=delete
ReusableThread is not copy-assginable.
bool get_readiness() const
ReusableThread(const ReusableThread &)=delete
ReusableThread is not copy-constructible.
ReusableThread(int threadid=0)
std::atomic< bool > m_thread_quit
void set_name(const std::string &name, int tid)
std::atomic< bool > m_task_executed
ReusableThread & operator=(ReusableThread &&)=delete
ReusableThread is not move-assignable.
ReusableThread(ReusableThread &&)=delete
ReusableThread is not move-constructible.
std::function< void()> m_task
void set_thread_id(int tid)