#547 should be destroyed using the pthread_attr_destroy()

Documentation
closed
nobody
5
2012-11-10
2012-07-03
Anonymous
No

When a thread attributes object is no longer required, it should be destroyed using the pthread_attr_destroy() function,

Thread_POSIX.cpp
void ThreadImpl::startImpl(Runnable& target)
{
if (_pData->pRunnableTarget)
throw SystemException("thread already running");

pthread_attr_t attributes;
pthread_attr_init(&attributes);

if (_pData->stackSize != 0)
{
    if (0 != pthread_attr_setstacksize(&attributes, _pData->stackSize))
        throw SystemException("cannot set thread stack size");
}

_pData->pRunnableTarget = ⌖
if (pthread_create(&_pData->thread, &attributes, runnableEntry, this))
{
    _pData->pRunnableTarget = 0;
    throw SystemException("cannot start thread");
}

if (_pData->prio != PRIO_NORMAL_IMPL)
{
    struct sched_param par;
    par.sched_priority = mapPrio(_pData->prio);
    if (pthread_setschedparam(_pData->thread, SCHED_OTHER, &par))
        throw SystemException("cannot set thread priority");
}

}

Discussion

  • fixed in 1.4.4, rev 1915

     
    • status: open --> closed
    • milestone: --> Documentation