Mark simple static methods in QThread as Q_DECL_NOTHROW
authorThiago Macieira <thiago.macieira@intel.com>
Mon, 6 Aug 2012 14:10:33 +0000 (16:10 +0200)
committerQt by Nokia <qt-info@nokia.com>
Sat, 18 Aug 2012 06:34:53 +0000 (08:34 +0200)
These methods aren't often used, but currentThreadId() gets used in the
recursive mutex code to store the identity of the thread with multiple
locks.

Change-Id: I031cf3893aa6e7fd7a53733fc1088d295bdb9079
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/thread/qthread.h
src/corelib/thread/qthread_unix.cpp
src/corelib/thread/qthread_win.cpp

index 953632c..978dbe8 100644 (file)
@@ -59,9 +59,9 @@ class QAbstractEventDispatcher;
 class Q_CORE_EXPORT QThread : public QObject
 {
 public:
-    static Qt::HANDLE currentThreadId();
+    static Qt::HANDLE currentThreadId() Q_DECL_NOTHROW;
     static QThread *currentThread();
-    static int idealThreadCount();
+    static int idealThreadCount() Q_DECL_NOTHROW;
     static void yieldCurrentThread();
 
     explicit QThread(QObject *parent = 0);
index d047cc8..f472dee 100644 (file)
@@ -381,7 +381,7 @@ void QThreadPrivate::finish(void *arg)
  ** QThread
  *************************************************************************/
 
-Qt::HANDLE QThread::currentThreadId()
+Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
 {
     // requires a C cast here otherwise we run into trouble on AIX
     return (Qt::HANDLE)pthread_self();
@@ -392,7 +392,7 @@ Qt::HANDLE QThread::currentThreadId()
 #  define _SC_NPROCESSORS_ONLN 84
 #endif
 
-int QThread::idealThreadCount()
+int QThread::idealThreadCount() Q_DECL_NOTHROW
 {
     int cores = -1;
 
index e443166..fb9ebf2 100644 (file)
@@ -390,12 +390,12 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway)
  ** QThread
  *************************************************************************/
 
-Qt::HANDLE QThread::currentThreadId()
+Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW
 {
     return (Qt::HANDLE)GetCurrentThreadId();
 }
 
-int QThread::idealThreadCount()
+int QThread::idealThreadCount() Q_DECL_NOTHROW
 {
     SYSTEM_INFO sysinfo;
     GetSystemInfo(&sysinfo);