From c1797c68677e7aaa0674baa12f8156a353017982 Mon Sep 17 00:00:00 2001 From: crs Date: Wed, 16 Oct 2002 19:40:29 +0000 Subject: [PATCH] Added matching pthread_attr_destroy() for each pthread_attr_init() in change 610. --- lib/mt/CThreadRep.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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.