Fix compilation of QThread on QNX

Commit 3ef51efbe7 broke compilation of
qthread_unix.cpp on QNX. This fixes it by passing in the threadId to
setCurrentThreadName().

Change-Id: I24f32d8054baedbd9a65b6a80fb1f6f37e07092d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Sean Harmer 2012-08-16 09:22:46 +01:00 committed by Qt by Nokia
parent c7b6a666a8
commit 47fd7128db

View File

@ -271,14 +271,16 @@ void QThreadPrivate::createEventDispatcher(QThreadData *data)
#ifndef QT_NO_THREAD
#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX))
static void setCurrentThreadName(const char *name)
static void setCurrentThreadName(pthread_t threadId, const char *name)
{
# if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
Q_UNUSED(threadId);
prctl(PR_SET_NAME, (unsigned long)name, 0, 0, 0);
# elif defined(Q_OS_MAC)
Q_UNUSED(threadId);
pthread_setname_np(name);
# elif defined(Q_OS_QNX)
pthread_setname_np(thr->d_func()->thread_id, name);
pthread_setname_np(threadId, name);
# endif
}
#endif
@ -317,9 +319,9 @@ void *QThreadPrivate::start(void *arg)
QString objectName = thr->objectName();
if (Q_LIKELY(objectName.isEmpty()))
setCurrentThreadName(thr->metaObject()->className());
setCurrentThreadName(thr->d_func()->thread_id, thr->metaObject()->className());
else
setCurrentThreadName(objectName.toLocal8Bit());
setCurrentThreadName(thr->d_func()->thread_id, objectName.toLocal8Bit());
#endif