From 2997b89e6480abfed356fbd6fe248bc6d2accbe2 Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 4 Jan 2012 15:19:49 +0000 Subject: QThreads on Symbian are named to allow them to be opened externally The Qt 4.7 implementation of QThread on Symbian used libpthread. This automatically generated a random name for a thread. The Qt 4.8 implmentation was leaving threads unnamed. This is a change in behaviour, in that unnamed/anonymous threads cannot be opened outside of the owning process. This was causing a bug in some client/server situations. The fix is to generate a name for the RThread underlying the QThread as follows: QThread object name + QThread object address + random number Task-number: ou1cimx1#959586 Reviewed-by: Shane Kearns --- src/corelib/thread/qthread_symbian.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qthread_symbian.cpp b/src/corelib/thread/qthread_symbian.cpp index 2ea1b447b8..78bb293c75 100644 --- a/src/corelib/thread/qthread_symbian.cpp +++ b/src/corelib/thread/qthread_symbian.cpp @@ -46,10 +46,12 @@ #include "qthreadstorage.h" #include "qthread_p.h" #include +#include #include #include #include +#include // You only find these enumerations on Symbian^3 onwards, so we need to provide our own // to remain compatible with older releases. They won't be called by pre-Sym^3 SDKs. @@ -509,7 +511,21 @@ void QThread::start(Priority priority) // operations like file I/O fail, so we increase it by default. d->stackSize = 0x14000; // Maximum stack size on Symbian. - int code = d->data->symbian_thread_handle.Create(KNullDesC, (TThreadFunction) QThreadPrivate::start, d->stackSize, NULL, this); + int code = KErrAlreadyExists; + QString objName = objectName(); + TPtrC objNamePtr(qt_QString2TPtrC(objName)); + TName name; + objNamePtr.Set(objNamePtr.Left(qMin(objNamePtr.Length(), name.MaxLength() - 16))); + const int MaxRetries = 10; + for (int i=0; idata->symbian_thread_handle.Create(name, (TThreadFunction) QThreadPrivate::start, d->stackSize, NULL, this); + } if (code == KErrNone) { d->thread_id = d->data->symbian_thread_handle.Id(); TThreadPriority symPriority = calculateSymbianPriority(priority); -- cgit v1.2.3