summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-02-141-38/+24
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/concurrent/doc/qtconcurrent.qdocconf src/corelib/doc/qtcore.qdocconf src/corelib/global/qglobal.h src/dbus/doc/qtdbus.qdocconf src/dbus/qdbusmessage.h src/gui/doc/qtgui.qdocconf src/gui/image/qimagereader.cpp src/network/doc/qtnetwork.qdocconf src/opengl/doc/qtopengl.qdocconf src/opengl/qgl.h src/plugins/platforms/windows/qwindowswindow.cpp src/printsupport/doc/qtprintsupport.qdocconf src/sql/doc/qtsql.qdocconf src/testlib/doc/qttestlib.qdocconf src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf src/widgets/doc/qtwidgets.qdocconf src/xml/doc/qtxml.qdocconf Change-Id: Ie9a1fa2cc44bec22a0b942e817a1095ca3414629
| * QThread documentation: do not discourage the reimplementation of QThreadOlivier Goffart2013-02-041-38/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new QThread documentation now really discourage to reimplement QThread. But in fact, there are many cases where it is perfectly fine. And the example given is even a case where using worker object is wrong. The examle even contains a leak since the thread will never stop and will even leak. This changes put back some sentences from before commit d4ad9dbbf96884c0899e8f8116a8a056facd52d5. The sample code has been re-writen. Notice how reimpementing run takes less lines of code, less runtime overhead, no leaks, and also is more complete than the previous example. Change-Id: I6cb80826e917dd5ce442ccad2572ec692ccb25ab Reviewed-by: Andre Somers <andre@familiesomers.nl> Reviewed-by: Geir Vattekar <geir.vattekar@digia.com> Reviewed-by: Debao Zhang <hello@debao.me> Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* | Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-2918-63/+0
| | | | | | | | | | | | | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* | Set some attributes on pthread condattrsThiago Macieira2013-01-283-14/+52
| | | | | | | | | | | | | | | | | | Make them use the monotonic clock if that's available. On Mac, the monotonic clock is not available -- Qt fakes monotonic support by using the Mach timebase -- so we need to use gettimeofday. Change-Id: Iaea0b0c0de1b4802780e2476dc3643b703db392c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-2348-48/+48
|\| | | | | | | refs/staging/dev
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-1848-48/+48
| | | | | | | | | | 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>
* Replace macro qdoc with Q_QDOCDebao Zhang2013-01-086-12/+12
| | | | | | | | Both qdoc and Q_QDOC are used in source code, which looks not good. Change-Id: I4f3a71670278b0758d92bfa5db086a07e1b1acfd Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Paul Olav Tvete <paul.tvete@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>
* Fix QMutex::tryLock with negative valuesThiago Macieira2012-12-231-3/+2
| | | | | | | | | | | | The Linux futex implementation had a Q_ASSERT for positive values, but the documentation says that negative values should be interpreted as infinite (equal to lock()). Test that too. Change-Id: I2f96a502d672732781e88e49797756ca9a809121 Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix some typosSergio Ahumada2012-12-211-2/+2
| | | | | Change-Id: I4e8d9bd8ea66ec810e4f1fbfd8ddbf25c4b3d980 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Review of documentation.Michele Caini2012-12-201-1/+1
| | | | | | | Terms fixing. Changes apply to Qt5 as well as Qt4. Change-Id: Ibb31ab0d68c62f3feb63722dd967932c2543fa37 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Similarly to the 797f3c0a01e9, fix qbasicatomic.h inclusionThiago Macieira2012-12-191-2/+2
| | | | | | | | qatomic.h includes qbasicatomic.h, so break the cyclic inclusion problem. Change-Id: If72bacbcfa36993336786f31e8980fbd43df8bdc Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Document the new load / store methods in QAtomic{Int,Pointer}Thiago Macieira2012-12-122-0/+86
| | | | | | | Task-number: QTBUG-24627 Change-Id: Iaa2573aa8f0f36cac81efa73020c2f365bfcba53 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Doc: Remove the mention of non-atomic convenience operators in QAtomicThiago Macieira2012-12-121-12/+0
| | | | | | | | | | For two reasons: 1) those operators are gone and 2) the ones that remain are atomic. Task-number: QTBUG-28532 Task-number: QTBUG-24627 Change-Id: I1e9d1b076d923546c1ee3d45f312066590f97416 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QtBase: Doc: Fix links to STL-style iteratorsDavid Schulz2012-12-061-4/+4
| | | | | Change-Id: I2822c2a7e9bfc1949c20ff81e08961f641e961fb Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fixed compatibility problem with ExceptionhandlingHolger Ihrig2012-11-301-1/+1
| | | | | | | | | | | When QtBase is compiled with Exeptions it was incompatible with the other modules compiled with QT_NO_EXCEPTIONS. This resulted in a linker error with ExceptionStore::throwPossibleExceptions, one time returning a const value and the other time without it Change-Id: I0e0dff61aceeec3cfde119b00ed15f3aa9f12659 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Document how to name threads.Mitch Curtis2012-11-281-0/+8
| | | | | | Change-Id: If7a7bf4f54509ebb86ce394d8bb5a7748ef419d5 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* QtCore: Make more signals private.Stephen Kelly2012-11-283-7/+15
| | | | | | Change-Id: Ida190e8b9c1ff47a6f54a5bf68673ab50a2f1bfe Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Fix race condition on d->state, by locking the mutex first.David Faure2012-11-231-3/+9
| | | | | | | | Detected by helgrind ./tst_qurl testThreads Change-Id: I0fe01153cd119741ce8a2bfe7dddead7c6ebf0b0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Fix QMutex::tryLock timeout computation on LinuxOlivier Goffart2012-11-161-2/+2
| | | | | | | | | | | The timeout is in millisecond. So we just need to divide by 1000 to get the number of seconds Regression introduced in f587e8f4fd670f11fa1e878c1015d7241033559a Reported in the comments of QTBUG-24795 Change-Id: Id16e05e7d04d33605860926f7516d14cdefd6a36 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFutureInterface: Remove unused functionOrgad Shaneh2012-11-082-6/+0
| | | | | | | | Following 731ba8ed08f80644b403556638c7f6229e678ebe this function is not used anymore Change-Id: Id908931b4b21c825bd80a4f03790630818c73c07 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for clang.Erik Verbruggen2012-11-071-1/+12
| | | | | | | | | | This triggers a bug in clang (before version 3.2). See also the bug report: http://llvm.org/bugs/show_bug.cgi?id=12670 . Change-Id: I9e0bc1cc39059ffa5e062652b932bc01e453ef98 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Review of documentation.Michele Caini2012-11-021-6/+25
| | | | | | | Documentation has been updated, changes apply to Qt5 as well as Qt4. Change-Id: I13241a3b4c16d2cb1b24f80fe26832467621923a Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix for leak in QFutureChristian Strømme2012-11-013-5/+46
| | | | | | | | | | | To avoid leaking when converting a QFuture<T> to a QFuture<void> we need to have a separate ref. counter for QFuture<T>. When the last QFuture<T> goes out of scope, we need to clean out the result data. Task-number: QTBUG-27224 Change-Id: I965a64a11fffbb191ab979cdd030a9aafd4436c2 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Remove stale QT_MODULE() usage casesKonstantin Ritt2012-10-251-2/+0
| | | | | | | As of Qt5, this macro is defined to be empty; simply get rid of these leftovers. Change-Id: I167ccb4c9e92ec9b5e4faeb02bf9c5ef5d982b50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Trim trailing whitespace.Stephen Kelly2012-10-221-1/+1
| | | | | Change-Id: Iee6bb66831f53399e5937eab5704af835979f5c3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove the QThread::terminated() signalSze Howe Koh2012-10-195-37/+9
| | | | | | | | | | | | | | | | | 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>
* Fix for memory leak in ResultStoreChristian Strømme2012-10-181-1/+4
| | | | | | | | | | | In ResultStoreBase::addResults() it possible that the ResultItem we create is invalid (filter-mode enabled). Since an invalid ResultItem won't have any result data, we need to make sure that we don't allocate any data for it. Task-number: QTBUG-27224 Change-Id: Ic99b191db0e9dd4e29b64911f87d90a8148bb7a5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* QThread signals documentation improvementOlivier Goffart2012-10-151-2/+12
| | | | | | | | | Be more explicit on from which thread the signals are emitted, and mention that it is possible to connect finished with deleteLater Change-Id: Ib72be94a81be383774f08d71915fa609843030e0 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Review of documentation.Michele Caini2012-10-131-2/+10
| | | | | | | | Documentation has been updated, changes apply to Qt5 as well as Qt4. Change-Id: I562914a439d8d27dc9e6b1aa117007edce214cc6 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Doc: Update QThread class ref to reflect changes since Qt 4.4Sze Howe Koh2012-10-081-55/+104
| | | | | | | | | | | | | | Remove advice to subclass QThread; promote thinking of QThread as a thread manager, not a thread; promote event-driven programming over time micromanagement; warn against common pitfalls. Result of collaboration in forum (https://qt-project.org/forums/viewthread/20691/) and mailing list (https://qt-project.org/pipermail/development/2012-September/006738.html) Task-number: QTBUG-16358 Change-Id: I57e3873976fad489176cbf9f7e680fd6992a8837 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* qfuturesynchronizer.cpp: fix whitespace errorsMarc Mutz2012-09-281-14/+14
| | | | | Change-Id: I106ae536f1411939c3785f0a97c39752db59b19c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QException/QFuture*: add \inmodule QtCoreMarc Mutz2012-09-284-0/+5
| | | | | Change-Id: Iad787e3280889eae6b6aace9a85bda966b1a7094 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QFutureSynchronizer back to QtCoreMarc Mutz2012-09-283-0/+277
| | | | | | | This class, too, belongs with QFuture. Change-Id: I41a532ca66c156f1631e4b22ffc1a5879c854488 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QFutureWatcher back to QtCoreMarc Mutz2012-09-285-1/+912
| | | | | | | | This belongs with QFuture. Change-Id: I555cd01c1d3890fbbaca4fd8a9170292ea4eb0fb Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QFuture from QtConcurrent to QtCoreMarc Mutz2012-09-286-0/+2020
| | | | | | | | | This class belongs to QThreadPool/QRunnable more than to QtConcurrent, so move to QtCore, where QThreadPool awaits it. Change-Id: Ibf20288a986593bf779453427c2dae8db1e1423a Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QtConcurrent::ResultStore as QtPrivate::ResultStore to QtCoreMarc Mutz2012-09-283-0/+496
| | | | | | | | | | No compatibility header needed. While this wasn't marked as private API, it wasn't documented, either. This is a prerequisite for moving QFuture to QtCore. Change-Id: I8e986e6e2a22fbe5cf08d0600ec39ae9ae993e20 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QtConcurrent::Exception as QException back to QtCoreMarc Mutz2012-09-283-0/+331
| | | | | | | | | Leave the old name as a deprecated typedef; adapt users. This is a prerequisite for moving QFuture back to QtCore. Change-Id: I81dcee2c7e6eb234c16f3f42e2415ca0da3dc4f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPostEventList: change pointer comparison to integer comparisonMarc Mutz2012-09-271-1/+1
| | | | | | | | | | This is exactly the type of pointer arithmetics that GCC likes to miscompile. Just use offset >= size() (=subtract begin() from both sides). Change-Id: Ifb13652d7b96bf4c06727d9c965516e95d16ab5c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Workaround MSVC2008 build failure after switching to std::upper_boundGiuseppe D'Angelo2012-09-271-7/+3
| | | | | | | | | | | | | | | | | QPostEventList is kept sorted by priority; std::upper_bound is used to insert a QPostEvent in the right place in the list. Turns out that MSVC2008 is a bit too picky and tries to see if the list is actually ordered. This causes a build failure as there is no operator< defined between two QPostEvents (in fact, an integer -- the priority -- is passed to std::upper_bound). Work around this issue by defining operator< between two QPostEvents. Change-Id: Ie3562dd0cc7253e25fc988b25d566d9d9e9fe62b Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix spelling mistakeThiago Macieira2012-09-271-1/+1
| | | | | | | Task-number: QTBUG-27355 Change-Id: I77ecc01e2a3ea1cac94e7c99c688cfd7cab5319b Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2236-852/+852
| | | | | | | | 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>
* Add comments to document the internals of QMutexOlivier Goffart2012-09-212-4/+54
| | | | | Change-Id: Ieb5632017e5e8e09a11dc6b929efa19b4f350086 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove qUpperBound usages from qtbaseGiuseppe D'Angelo2012-09-192-2/+6
| | | | | | | | | Replace them with std::upper_bound; this allows for deprecation of qUpperBound. Change-Id: Idef01d2228b9a70eee3d52931d7aedb5bb6ba902 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Move QRecursiveMutexPrivate to qmutex.cpp and mark inlineThiago Macieira2012-09-142-14/+15
| | | | | | | | | | | | | | | | | Disassembly of the optimised code shows that the compiler was already inlining the bodies of one or both functions (since they're in the same .cpp, it's allowed to do that). However, since there was no "inline" marker, the compiler was also emitting an out-of-line copy, which wasn't used by anyone, as the class is not exported. So add the marker. To make sure that they don't get used by accident elsewhere, the class is moved to the .cpp file too. Change-Id: Iead578ec9c7d8dd6b4e6bb582ce5b829cdec5992 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Remove QBasicAtomic::tryLock with a timerThiago Macieira2012-09-141-2/+2
| | | | | | | | | | The non-futex implementation does not support timed locks in QBasicMutex. That is only supported in QMutex (due to the destructor). Change-Id: I46d33a66a36e05c8a4344823537178e80a6ddd76 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* #include the qmutex_xxx.cpp at the end of qmutex.cppThiago Macieira2012-09-141-1/+10
| | | | | | | | This produces slightly better inlining results. Change-Id: Ie86471577f888cb2d9c9989306ec69ce0a296108 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Use storeRelease to unlock a mutex instead of fetchAndStoreReleaseThiago Macieira2012-09-141-1/+1
| | | | | | | | We're not checking the result anyway, so use a simpler operation. Change-Id: I8c2db35be86660b29d81dd97ce3e269de55a37df Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>