summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-07-07 15:55:04 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-07-08 09:47:25 (GMT)
commit9f0d39135141e9f048d4cb3647a9e50f3d3db5a1 (patch)
tree764cfacd2a5eaace3375cd2d95bf98eafa4b7f69 /src/corelib/thread
parentaa7de4f45660b5e1c470bf876606f846e120dd50 (diff)
downloadQt-9f0d39135141e9f048d4cb3647a9e50f3d3db5a1.zip
Qt-9f0d39135141e9f048d4cb3647a9e50f3d3db5a1.tar.gz
Qt-9f0d39135141e9f048d4cb3647a9e50f3d3db5a1.tar.bz2
Set QThreads to be process critical automatically on Symbian OS
On Symbian OS, a thread is non critical by default - this means if it crashes the process does not automatically terminate, rather it is allowed to handle the crash by itself. Only the main thread is critical by default. Since this is not the behaviour on other platforms, application developers are unlikely to have considered this case - and would need to write symbian specific code to catch the crash. For such advanced users, they can reset the critical flag on the thread once they get control in QThread::run(). By default, a crash in any thread created via the QThread API will now crash the process. Reviewed-by: Iain
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread_unix.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 6b34b5f..d193b2e 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -247,6 +247,14 @@ void *QThreadPrivate::start(void *arg)
data->symbian_thread_handle = RThread();
TThreadId threadId = data->symbian_thread_handle.Id();
data->symbian_thread_handle.Open(threadId);
+ // On symbian, threads other than the main thread are non critical by default
+ // This means a worker thread can crash without crashing the application - to
+ // use this feature, we would need to use RThread::Logon in the main thread
+ // to catch abnormal thread exit and emit the finished signal.
+ // For the sake of cross platform consistency, we set the thread as process critical
+ // - advanced users who want the symbian behaviour can change the critical
+ // attribute of the thread again once the app gains control in run()
+ User::SetCritical(User::EProcessCritical);
#endif
pthread_once(&current_thread_data_once, create_current_thread_data_key);