26 std::array<char, 1024>
buffer;
44 if (0 != (erno = pthread_attr_init(&attr))) {
46 <<
"Failed to initialize thread attributes (" << erno <<
") " << errorMessage(erno);
49 if (0 != (erno = pthread_attr_setstacksize(&attr, stackSize))) {
51 <<
"Failed to set stack size " << stackSize <<
" " << errorMessage(erno);
53 std::unique_lock<std::mutex> lk(
m_mutex);
57 throw cms::Exception(
"ThreadCreateFailed") <<
" failed to create a pthread (" << erno <<
") " << errorMessage(erno);
104 std::unique_lock<std::mutex> lck(theThis->m_mutex);
105 theThis->m_loopReady =
true;
106 theThis->m_threadHandoff.notify_one();
109 theThis->m_toRun =
nullptr;
110 theThis->m_threadHandoff.wait(lck, [theThis]() {
return nullptr != theThis->m_toRun; });
111 theThis->m_toRun->execute();
112 theThis->m_loopReady =
true;
113 theThis->m_threadHandoff.notify_one();
114 }
while (not theThis->m_stopThread);
115 theThis->m_loopReady =
true;
ThreadHandoff(int stackSize)
ret
prodAgent to be discontinued
std::condition_variable m_threadHandoff
static void * threadLoop(void *iArgs)