Added matching pthread_attr_destroy() for each pthread_attr_init()

in change 610.
This commit is contained in:
crs 2002-10-16 19:40:29 +00:00
parent d9c622ae04
commit c1797c6867
1 changed files with 8 additions and 3 deletions

View File

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