30 std::this_thread::sleep_for(std::chrono::milliseconds(1));
34 std::this_thread::sleep_for(std::chrono::milliseconds(1));
45 snprintf(tname, 16,
"%s-%d", name.c_str(), tid);
46 auto handle =
m_thread.native_handle();
47 pthread_setname_np(handle, tname);
60 auto handle =
m_thread.native_handle();
63 CPU_SET(cpuid, &cpuset);
64 int rc = pthread_setaffinity_np(handle,
sizeof(cpu_set_t), &cpuset);
67 ers::warning(ThreadingIssue(
ERS_HERE,
"Error calling pthread_setaffinity_np: " + std::to_string(rc)));
74 std::unique_lock<std::mutex> lock(
m_mtx);
std::atomic< bool > m_worker_done
std::atomic< bool > m_task_assigned
std::atomic< bool > m_named
std::condition_variable m_cv
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
std::function< void()> m_task
void set_thread_id(int tid)
void warning(const Issue &issue)