diff --git a/lib/mt/CThreadRep.cpp b/lib/mt/CThreadRep.cpp index 56ec0c41..1e487cf2 100644 --- a/lib/mt/CThreadRep.cpp +++ b/lib/mt/CThreadRep.cpp @@ -110,8 +110,10 @@ CThreadRep::CThreadRep(IJob* job, void* userData) : // pthread_create() RedHat 7.2 smp fails with a NULL attr. pthread_attr_t attr; int status = pthread_attr_init(&attr); - if (status == 0) + if (status == 0) { status = pthread_create(&m_thread, &attr, threadFunc, (void*)this); + pthread_attr_destroy(&attr); + } pthread_sigmask(SIG_SETMASK, &oldsigset, NULL); if (status != 0) { throw XMTThreadUnavailable(); @@ -189,10 +191,13 @@ CThreadRep::initThreads() // we'd be unable to cancel the main thread since no pthread // calls are allowed in a signal handler. pthread_attr_t attr; - pthread_attr_init(&attr); - int status = pthread_create(&s_signalThread, &attr, + int status = pthread_attr_init(&attr); + if (status == 0) { + status = pthread_create(&s_signalThread, &attr, &CThreadRep::threadSignalHandler, getCurrentThreadRep()); + pthread_attr_destroy(&attr); + } if (status != 0) { // can't create thread to wait for signal so don't block // the signals.