mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-25 03:53:18 +03:00
Added matching pthread_attr_destroy() for each pthread_attr_init()
in change 610.
This commit is contained in:
parent
d9c622ae04
commit
c1797c6867
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user