summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-161-12/+12
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/plugin/qlibrary_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
| * Turn QThreadData::threadId into a QAtomicPointerThiago Macieira2017-02-151-12/+12
| | | | | | | | | | | | | | | | | | | | | | Solves a data race found by TSan. Since thread and threadId are QAtomicPointer, I've removed the explicit initialization in the QThreadData constructor Task-number: QTBUG-58855 Change-Id: I4139d5f93dcb4b429ae9fffd14a34082f2683f76 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Use std::enable_if instead of QEnableIfAlexander Volkov2017-01-271-4/+4
|/ | | | | | Change-Id: Ideca8283141484cb6da47c50333f5c96e416f082 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Add support for Apple watchOSJake Petroules2016-08-191-2/+2
| | | | | Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-201-16/+39
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
| * Fix cast warnings when pthread_t is smaller than a pointerJames McDonnell2016-06-131-16/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Push conversions from pthread_t to Qt::HANDLE and back into functions. The casts that were being used didn't work for the unusual 64-bit pointer/32-bit int combination that QNX is using for 7.0. HANDLE ends up as a 64-bit pointer and pthread_t ends up as a 32-bit integer. g++ considers the precision loss when converting from the 64-bit pointer to the 32-bit integer an error. Better to have the casts hidden in functions so it's easier to adjust them for unusual combinations such as this. Change-Id: Ia156b26224a0f7edc1c31e3d1ee8b21191381698 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-061-16/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/qtestlib/tutorial5/containers.cpp examples/widgets/tools/tools.pro src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/network/kernel/qdnslookup_unix.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp tools/configure/configureapp.cpp Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
| * Don't store the pthread_t thread ID twice in QThreadThiago Macieira2016-04-301-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was being stored once in QThreadPrivate and once in QThreadData, with the latter being hidden as a Qt::HANDLE. Besides saving a little bit of memory, this also solves a small data race condition that arises from trying to connect a signal to an object moved to that thread and then emit that signal shortly after the thread starts. Before this patch, QThreadData::threadId was initialized only by QThreadPrivate::start(), which meant that we were racing that initialization with this check in QMetaObject::activate: const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId; Task-number: QTBUG-52337 Change-Id: Ifea6e497f11a461db432ffff1449ae01f1099aae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-11-231-4/+18
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qcoreapplication.cpp src/corelib/thread/qthread_unix.cpp Change-Id: Ia08d613c3f0bd08cb6dc3e3a57257207dfd4a099
| * OS X: Add opt-in for CoreFoundation event dispatcherMorten Johan Sørvig2015-11-191-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt-in by setting QT_EVENT_DISPATCHER_CORE_FOUNDATION=1 This will make QCoreApplication and QThread create a QEventDispatcherCoreFoundation instead of a QEventDispatcherUNIX. With this change we can now support calling native API that requires a running Core Foundation event loop on the QCoreApplication main thread and secondary threads. Previously this was only supported on the QGuiApplication main thread. Rewrite the #ifdef event dispatcher logic slightly: both OSX and GLIB now gets an "else" branch for the UNIX event dispatcher, instead of the current "dangling else" pattern which only works for one #ifdef case. Change-Id: If853567fa097fe007502b0804c2307a989719866 Task-number: QTBUG-46625 Task-number: QTBUG-48758 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove remaining support for BlackberryLouai Al-Khanji2015-11-211-11/+4
|/ | | | | | | | | The platform is no longer supported or actively maintained, and is in the way for improvements to the Unix event dispatcher and QProcess implementations. Change-Id: I3935488ca12e2139ea5f46068d7665a453e20526 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * Fix two data races in QThread/QThreadDataDavid Faure2015-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * theMainThread is written by the main thread and read by QThreadData::~QThreadData() (any managed thread) * QThreadData::thread is written by QThread::~QThread (in the parent thread) and read+written by QThreadData::~QThreadData (in the managed thread). This can happen because QThreadData is refcounted so the managed thread (which derefs it) races with the parent thread (which sets it to 0). Change-Id: I72de793716391a0937254cda6b4328fcad5060c7 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Clean up some Apple-related includes and declarations.Jake Petroules2015-09-221-3/+0
| | | | | | | | | | Change-Id: I92db9691c2243ae72ecd4e11dd4640afaf4bf822 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | QThread: simplify the pthread_cleanup_pop functionThiago Macieira2015-07-161-7/+8
|/ | | | | | | | | Make sure that the QString is not in scope anymore when the pthread cleanup happens. C++ destructors in scope are pthread cleanup handlers. Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1ae1c7e31f6bb Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-04-151-1/+1
|\ | | | | | | Change-Id: I004854a25ebbf12b1fda88900162fe7878716c58
| * Doc: Fix using Apple-related terminology in Qt CoreAlexander Volkov2015-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | Use the name "OS X" instead of "Mac OS X", "Mac OS" and "OSX", and mention iOS. Replace "Carbon Preferences API" by "CFPreferences API" in the QSettings documentation. Change-Id: Ia7f9fb874276c7c445a1649df521b96ff43daa0c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-4/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/xml/htmlinfo/simpleexample.html examples/xml/rsslisting/rsslisting.cpp qmake/generators/win32/msbuild_objectmodel.cpp src/3rdparty/harfbuzz-ng/src/hb-private.hh src/corelib/global/qlogging.cpp src/corelib/io/qstorageinfo_unix.cpp src/corelib/thread/qwaitcondition_unix.cpp src/gui/kernel/qguiapplication.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp src/testlib/doc/src/qt-webpages.qdoc tests/auto/other/qaccessibility/tst_qaccessibility.cpp Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
| * Make the detection of the number of cores on Unix prettierThiago Macieira2015-02-151-4/+2
| | | | | | | | | | | | | | This is a no-op change. It doesn't improve or worsen the code at all. Change-Id: Ifd5273842370ca9bce0ed74f2f2d54d453797948 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* | Remove Q_C_CALLBACKSThiago Macieira2015-01-171-6/+0
|/ | | | | | | | | | | | | | This is useless. The C++ language does require callbacks passed to C functions to also be extern "C". That's what this macro was doing. But #ifdef'ing for the macro only made the code uglier. Just let the extern "C" be there for all compilers. PS: C++ classes can't be extern "C"... Change-Id: Ic5d393bfd36e48a193fcffff13b9c9b3923443dd Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix QThread::idealThreadCount on Unix if sysconf or sysctl failsThiago Macieira2014-12-201-1/+2
| | | | | | | | | | The BSD4 code (including OS X) calls sysctl and if that fails, it sets cores to -1. Similarly, the generic Unix code calls sysconf() and assigns the returned value to cores, but sysconf can return -1 on failure. Change-Id: I9e521d366e9c42f36c2ba20a37e7a74539ddb8f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Android: Don't register main thread on loading libraryEskil Abrahamsen Blomfeldt2014-01-161-2/+2
| | | | | | | | | | | | | | | | | | | When building with debug, all SLOT or SIGNAL macros will expand to a function call, and then function will call QThreadData::current(), which will set QCoreApplication::theMainThread if it has not already been done. Since Qt Widgets has these macros in the static initialization of the library, we would register the Android main thread as the main thread of Qt, which would mean that the actual application object was created on a different thread than the main thread. This caused warnings to appear, and also triggered a race condition which caused widget applications to sometimes show a black screen instead of content on startup when run with the OpenGL plugin. Task-number: QTBUG-35048 Change-Id: Ie8979f5e7cd5662f8d7dd276de9f94f27cc120b5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add an advisory interruption mechanism to QThread.Corentin Jabot2013-09-051-0/+2
| | | | | | | | | | | | | | To ease interruption of long running tasks, a new method QThread::setInterruptionRequested() can be called. The task can check QThread::isInterruptionRequested() and act upon it by stopping itself. These methods are designed to replace the use of a global variable and other hacky ways to stop a task running in another thread. Change-Id: I17622dd60d2262078210e7e4294ad6c53a6dc179 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Further followup to Q_OS_MACX changes.Jake Petroules2013-06-241-2/+2
| | | | | | | | Flip !Q_OS_IOS conditions to Q_OS_MACX where it seems appropriate, remove a redundant condition in qtextcodec_p.h. Change-Id: I21c8c0c490f1eb4a9337a7f2f3e907c125489438 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Fix crash when re-creating QThreadData after initially destroying itTor Arne Vestbø2013-06-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We destroy the thread data for the main thread when the QCoreApplication is destructed, and then delete the pthread key for the thread data in the global static destructor function 'destroy_current_thread_data_key'. The user may have its own Q_DESTRUCTOR_FUNCTION though, which may or may not run after we've destroyed the key. If it runs after we've destroyed the key, we'll end up trying to re-create the tread-data, as expected, but set_thread_data() will fail to persist it, as pthread_setspecific is called with an invalid key. The result is an infinite recursion: ... 6 in QThreadData::current () at qthread_unix.cpp:216 7 in QObject::QObject (this=0x48e1b30, dd=@0x48e1b40, parent=0x0) at qobject.cpp:703 8 in QThread::QThread (this=0x48e1b30, dd=@0x48e1b40, parent=0x0) at qthread.cpp:396 9 in QAdoptedThread::QAdoptedThread (this=0x48e1b30, data=0x48e1af0) at qthread.cpp:120 10 in QAdoptedThread::QAdoptedThread (this=0x48e1b30, data=0x48e1af0) at qthread.cpp:130 11 in QThreadData::current () at qthread_unix.cpp:219 12 in QObject::QObject (this=0x48e1a20, dd=@0x48e1a30, parent=0x0) at qobject.cpp:703 ... To solve this, we reset current_thread_data_once when destroying the key, so that subsequent calls to pthread_once to potentially create the key will call create_current_thread_data_key once more. This means we'll leak the key for this particular use-case, since we don't end up calling pthread_key_delete a second time, but this leak is small and happens typically only for a short duration during application shutdown. Change-Id: I580484a3239849e891172e24e7f77b75afd2c51b Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix race condition in QThread::setPriorityDavid Faure2013-03-231-22/+17
| | | | | | | | | | | | | The value of priority was read without the mutex locked, from within the thread. Had to extract a QThreadPrivate::setPriority method so that it can be called with the mutex already locked. So if the main thread calls setPriority while the thread is starting, it will be either be before or after the "re-set priority" code at thread startup, but at least not in the middle of it. Change-Id: I7a054f68623f61482c749274da66f3b2dcd8bcee Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QThread: fix race when setting the eventDispatcherDavid Faure2013-03-221-7/+7
| | | | | | | Use QAtomicPointer to make this thread-safe. Change-Id: If71f204699fcefabdb59bd26342d777d1cc9e2a7 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Clear the current thread data for the main threadThiago Macieira2013-03-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | This avoids crashes accessing deleted memory when creating a QObject after the last QObject had been deleted, like a qDebug() in global destructors. ==41000== Invalid read of size 4 ==41000== at 0x5F01ED5: bool QBasicAtomicOps<4>::ref<int>(int&) (qatomic_x86.h:208) ==41000== by 0x5F01309: QBasicAtomicInteger<int>::ref() (qbasicatomic.h:147) ==41000== by 0x5F24051: QThreadData::ref() (qthread.cpp:100) ==41000== by 0x614A984: QObject::QObject(QObject*) (qobject.cpp:681) ==41000== Address 0x6ee73f0 is 0 bytes inside a block of size 152 free'd ==41000== at 0x4A0736C: operator delete(void*) (vg_replace_malloc.c:480) ==41000== by 0x5F240BF: QThreadData::deref() (qthread.cpp:109) ==41000== by 0x6113F6B: QCoreApplicationData::~QCoreApplicationData() (qcoreapplication.cpp:268) The comment right above the change in qthread.cpp looks eerily similar to the problem I'm trying to fix. However, the actual change that introduced the change is not in the Qt public history, so we can't know for sure what the problem was then. Change-Id: I0dba895b041fe6cf81e6f8939ca85035cd00aad1 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Introducing the Qt Android portPaul Olav Tvete2013-03-051-4/+4
| | | | | | | | | | | | | | | | | | | | | Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Added support for multicore CPUs for INTEGRITY (V10+) target.Florian Behrens2013-01-301-0/+7
| | | | | | | QThread::idealThreadCount returns now the number of cores. Change-Id: Idc23fc3c257165f6a63c6a7686a57a4fe76f6413 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-231-1/+1
|\ | | | | | | refs/staging/dev
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Use sched_get_priority_* functions only for SCHED_RR and SCHED_FIFOPasi Petäjäjärvi2013-01-231-2/+14
|/ | | | | | | | | In VxWorks set default values for scheduling priority to use SCHED_FIFO_HIGH_PRI and SCHED_FIFO_LOW_PRI defines for other scheduling policies than SCHED_RR or SCHED_FIFO. Change-Id: If78b84cd9ef94d7712206e9442e96cdba727610f Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Don't use MPProcessorsScheduled on Mac OS XThiago Macieira2012-12-281-5/+2
| | | | | | | | | | | It's deprecated and it's not available on iOS anyway. The recommended way of getting the number of processors online is via sysctl or sysconf (both of which are just slightly below). qthread_unix.cpp:397:13: error: 'MPProcessorsScheduled' is deprecated: first deprecated in Mac OS X 10.7 [-Werror,-Wdeprecated-declarations] Change-Id: I4bf60985fbde155b78b840f3de3ff0a142b78b19 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* QtCore: Make more signals private.Stephen Kelly2012-11-281-2/+2
| | | | | | Change-Id: Ida190e8b9c1ff47a6f54a5bf68673ab50a2f1bfe Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Remove the QThread::terminated() signalSze Howe Koh2012-10-191-7/+0
| | | | | | | | | | | | | | | | | The signal is removed from the API; all references to it are removed from documentation; the unit test that checks for its emission is modified to listen for QThread::finished() instead. The QThreadPrivate::terminated flag is also removed, as it served no purpose other than to trigger the emission of QThread::terminated() As discussed at http://lists.qt-project.org/pipermail/development/2012-October/007216.html the signal is not guaranteed to be emitted after every termination, rendering it useless. Change-Id: I7b0c45d7889da0d33875545331606f2208ee56fc Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Use nanosleep instead of pthread_cond_timedwait for thread sleepingThiago Macieira2012-08-251-40/+8
| | | | | | | | | | | | | | | There's a comment saying nanosleep's availability is questionable, but the information of what systems don't have that is now lost in time. It's quite likely that they were older, Unix systems we no longer support anyway. nanosleep comes from POSIX.1b-1993, which is merged into POSIX.1-2001, so chances are that it's supported almost everywhere where Qt runs (except for Windows anyway). Change-Id: I4fd18f8715c43a42429000f3b3d2c3b7343f94b4 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Mark simple static methods in QThread as Q_DECL_NOTHROWThiago Macieira2012-08-181-2/+2
| | | | | | | | | | 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>
* Fix compilation of QThread on QNXSean Harmer2012-08-171-4/+6
| | | | | | | | | | Commit 3ef51efbe75bfb9f1dfbe7df073e9eb745a72ad8 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>
* Avoid an expensive call to toLocal8Bit upon thread creationThiago Macieira2012-08-151-10/+18
| | | | | | | | | | | | | | | QString::toLocal8Bit() will need to call QTextCodec::codecForLocale(), which isn't the cheapest of the functions, at least the first time it's run. So avoid calling it when in most scenarios, the name of the QObject isn't set, and the information is purely for debugging. Additionally, avoid allocating memory when setting the thread name to the class name. The class name coming from the meta object is a static constant string and we can use it directly. Change-Id: Ief643bad87a51487b1d41c0a2f323e80bb53e8a7 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Make the "\internal" qdoc command stand on its own lineLaszlo Papp2012-08-151-1/+2
| | | | | | | | | | The qdoc manual currently claims that the command must stand on its own line. The change follows the consistency with the rest and how the example looks like inside the qdoc manual for this command. Change-Id: I6b653dc95cf9d84e4adf32220dace5d313678419 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QtCore: use new qEnvironmentVariableIs{Set,Empty}()Marc Mutz2012-08-141-2/+2
| | | | | | | | | | | | In particular, qEmergencyOut() is now completely exception-free. Incidentally, this patch shows that Qt isn't consistent in how it treats empty environment variables used as flags, but that is something for a separate commit. This patch aims to be behaviour-preserving, except in exceptional circumstances, of course. Change-Id: Ie106e7b430e1ab086c40c81cc1e56cd0e5400cb4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Guard some pthread API with the appropriate POSIX check, or Android.Robin Burchell2012-05-041-0/+12
| | | | | | | | Android does not support some parts of POSIX. It's also unfortunately not POSIX-compliant, meaning we need to guard things like pthread_cancel. Change-Id: I2979eb5579c822f4f5ba27bcc29e118b908e8bdc Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Integrate Blackberry Platform Services (BPS) with Qt event loop.Jeff Kehres2012-04-241-4/+13
| | | | | | | | | | | | This ensures interoperability between the Blackbery C and C++ APIs and makes it easier to expose platform services in C++ that are exposed in BPS - since events from both APIs can be processed on the same thread. Change-Id: I7270adc64c26396f66d9126141500d5e58be51e7 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Set thread name on QNXSean Harmer2012-04-231-1/+3
| | | | | | | Change-Id: I4fc786afce2e53676b148332dddd2c84228f7d87 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>