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