From abee021db21de54c96232153f67f6b936e40f4ab Mon Sep 17 00:00:00 2001 From: crs Date: Tue, 15 Oct 2002 21:35:12 +0000 Subject: [PATCH] Workaround for pthread bug on RedHat 7.2 on multiprocessor systems. --- lib/mt/CThreadRep.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/mt/CThreadRep.cpp b/lib/mt/CThreadRep.cpp index f79a2787..a60254b5 100644 --- a/lib/mt/CThreadRep.cpp +++ b/lib/mt/CThreadRep.cpp @@ -106,7 +106,11 @@ CThreadRep::CThreadRep(IJob* job, void* userData) : sigaddset(&sigset, SIGINT); sigaddset(&sigset, SIGTERM); pthread_sigmask(SIG_BLOCK, &sigset, &oldsigset); - int status = pthread_create(&m_thread, NULL, threadFunc, (void*)this); + // pthread_create() RedHat 7.2 smp fails with a NULL attr. + pthread_attr_t attr; + int status = pthread_attr_init(&attr); + if (status == 0) + status = pthread_create(&m_thread, &attr, threadFunc, (void*)this); pthread_sigmask(SIG_SETMASK, &oldsigset, NULL); if (status != 0) { throw XThreadUnavailable(); @@ -183,7 +187,9 @@ CThreadRep::initThreads() // instead arrange to catch and handle these signals but // we'd be unable to cancel the main thread since no pthread // calls are allowed in a signal handler. - int status = pthread_create(&s_signalThread, NULL, + pthread_attr_t attr; + pthread_attr_init(&attr); + int status = pthread_create(&s_signalThread, &attr, &CThreadRep::threadSignalHandler, getCurrentThreadRep()); if (status != 0) {