summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-051-0/+7
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/minimum-linux.S src/network/access/qhttpthreaddelegate.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Id2e817e85f85c68f5482c9a12912d35590f9d5f8
| * Add a comment about the weird refcount for adopted QThreadDataThiago Macieira2017-10-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's perfectly benign, but I spent a lot of time debugging this and trying to figure out how to solve something that didn't need solving. So document for posterity. For an adopted thread, the TLS destructors or the adopted thread watcher on Windows will call QThreadData::deref(): - QThreadData::deref(), count drops to zero -> delete this; - ~QThreadData() deletes the QAdoptedThread -> delete t; - ~QThreadPrivate() calls deref() again -> data->deref(); - QThreadData::deref(), count drops to -1, no action taken - ~QObjectPrivate() calls deref() yet again -> threadData->deref() - QThreadData::deref(), count drops to -2, no action taken Change-Id: Icaa86fc7b54d4b368c0efffd14ee448e0796e8d7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove references to obsolete platformsJake Petroules2017-11-051-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ultrix and reliant have not seen a release since 1995. dgux not since 2001. bsdi not since 2003. irix not since 2006. osf not since 2010. dynix... unclear, but no later than 2002. symbian needs no mention. All considered obsolete, all gone. sco and unixware are effectively obsolete. Remove them until someone expresses a real need. Change-Id: Ia3d9d370016adce9213ae5ad0ef965ef8de2a3ff Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QSemaphore: Fix futexMultiWaiterBit for 32bit systemsUlf Hermann2017-11-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | We don't actually need it in that case, but as the code that uses it is disabled by a constant expression we cannot disable the variable itself by a macro. The static_cast makes sure the compiler does not complain about implicitly casting a 64bit value to a 32bit one. thread/qsemaphore.cpp:156:59: error: large integer implicitly truncated to unsigned type [-Werror=overflow] Task-number: QTBUG-64261 Change-Id: I96f53e28b290e57033737b4f994f8af5b5666587 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devAllan Sandfeld Jensen2017-10-243-32/+141
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/windows/qwindowsmousehandler.cpp src/plugins/platforms/xcb/qxcbimage.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/manual/qtabletevent/regular_widgets/main.cpp Done-with: Friedemann Kleint<Friedemann.Kleint@qt.io> Done-with: Mårten Nordheim<marten.nordheim@qt.io> Change-Id: I5b2499513a92c590ed0756f7d2e93c35a64b7f30
| * QBasicMutex: mark the bootstrap constructor constexprThiago Macieira2017-10-191-1/+1
| | | | | | | | | | | | | | QBasicMutex and QMutex are the same in bootstrap mode. Change-Id: Icaa86fc7b54d4b368c0efffd14eed63343ddb51b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-162-31/+140
| |\ | | | | | | | | | Change-Id: I3cf73c53cf131d0babfb558c2507bed0e0fc5f08
| | * Improve performance in QThreadPoolSvenn-Arne Dragly2017-10-042-31/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When many runnables are executed, this improves the performance by not resizing the queue for each runnable, which was the case in the previous version, because of many calls to QVector::takeFirst(). Also add a test that makes sure tryTake() is safe to call and does not leave the queue in a bad state that tries to use nullptr entries. Change-Id: I608134ecfa9cfc03db4878dcbd6f9c1107e13e90 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QSemaphore: Improve waking up on 64-bit LinuxThiago Macieira2017-10-232-27/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By judiciously positioning of the bits, we can optimize for the case of threads trying to acquire a single token, which is what QSemaphore should be mostly used for, as it matches the POSIX Semaphore API (sem_wait, sem_timedwait and sem_trywait). If there are only waiters waiting for a single token, we know that adding n tokens means n threads can wake up. This optimizes for multi-token waiters too. For example, if we have 50 single-token waiters and 50 multi-token waiters, a sem.release(5) will wake up 55 threads instead of 100. Change-Id: I209fcd5dbc2b4e5381cffffd14de5550c75d2600 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-10-172-23/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/fortuneclient/client.cpp examples/network/fortuneserver/server.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h src/plugins/platforms/cocoa/qcocoabackingstore.h src/plugins/platforms/cocoa/qcocoaintegration.h src/plugins/platforms/cocoa/qcocoascreen.h src/plugins/platforms/ios/qiosbackingstore.h src/plugins/sqldrivers/oci/qsql_oci.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
| * | Move detection of <future> to a configure testGiuseppe D'Angelo2017-10-062-23/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <future> is needed by QThread::create. Instead of a fragile series of preprocessor tests, move its detection to a configure test. This dramatically simplifies the code, but on the other hand ties the availability of QThread::create() to the system used to compile Qt (rather the one used to compile an application). Change-Id: If1b06363379bf29126cfa68f2a0651cbb78a67f7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-09-263-73/+89
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h src/plugins/platforms/cocoa/qcocoawindow.h src/testlib/qtestsystem.h Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
| * | QThread::create: move implementation out of lineGiuseppe D'Angelo2017-09-242-69/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we accept STL datatypes in our ABI, expose a factory function that takes a std::future<void>, and hide the QThread subclass in our implementation. This also solves the problem of a non-exported polymorphic class that would generate duplicate vtables / typeinfo in all TUs. Change-Id: I70a5c301e7c589de1a4a189db39b86b956d1ba0d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | QThread::create: make qdoc generate its documentationGiuseppe D'Angelo2017-09-241-0/+7
| | | | | | | | | | | | | | | Change-Id: I6eaaa0f9cbda6ef985cda63f2bf36d3102f34f32 Reviewed-by: Martin Smith <martin.smith@qt.io>
| * | Merge dev into 5.10Frederik Gladhorn2017-09-021-1/+1
| |\ \ | | | | | | | | | | | | Change-Id: I5fb5e7e6e57bb5db6fcb1f670f7f6cbc8def2d60
| * | | Fix documentation of QThreadPool::stackSizeFriedemann Kleint2017-08-291-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warning qthreadpool.h:61: warning: No documentation for 'QThreadPool::stackSize' Amends e44ff1978344600cd9b1f41949697f0e877fd5cd. Change-Id: I060de623b2befcc55846e1827b9cd58aacf3a3c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | | Add the "we mean it" warning to qfutex_p.hMårten Nordheim2017-09-221-0/+11
| | | | | | | | | | | | | | | | | | | | Change-Id: I77a0899532e2a38fa390991bbad11300672544bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-199-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-196-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | Port QSemaphore to use futexesThiago Macieira2017-09-184-15/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is interesting because QSemaphore now needs to allocate no memory: it's just a simple 31-bit counter and the contention flag. Change-Id: I6e9274c1e7444ad48c81fffd14dbc0ab42bc2e00 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Move the futex implementation to a headerThiago Macieira2017-09-183-50/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | So I can use it in QSemaphore and provide a Windows implementation. Change-Id: I6e9274c1e7444ad48c81fffd14dbc0a8e2201302 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Fix zero-as-null-pointer-constant warning in QObjectJesus Fernandez2017-09-051-3/+3
| |/ / |/| | | | | | | | | | | | | | | | | Change-Id: Icf0c836b96cd750edeee71c144e2bd9917a96815 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-08-311-1/+1
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/examples.pro qmake/library/qmakebuiltins.cpp src/corelib/global/qglobal.cpp Re-apply b525ec2 to qrandom.cpp(code movement in 030782e) src/corelib/global/qnamespace.qdoc src/corelib/global/qrandom.cpp src/gui/kernel/qwindow.cpp Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08) src/network/ssl/qsslkey_openssl.cpp src/plugins/platforms/android/androidjniinput.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/widgets/widgets/qmenu.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
| * Android: Fix compile with unified headersBogDan Vatra2017-08-171-1/+1
| | | | | | | | | | | | | | | | Unified headers now defines _POSIX_THREAD_SAFE_FUNCTIONS but not all libc functions are available in all Android API versions. Change-Id: I01c94f0b89e7f8aa8575e7bbda28d9fe41a68ff1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Correct QThread::idealThreadCount() docsMorten Johan Sørvig2017-08-021-1/+1
| | | | | | | | | | | | | | | | | | QThread::idealThreadCount() now returns 1 if the number of CPU cores could not be detected. Change-Id: I60b75c46fbfa2891c28e71fed65589e2ce5a5c17 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add QThreadPool::stackSizeMorten Johan Sørvig2017-08-023-1/+32
| | | | | | | | | | | | | | | | | | Allows setting the stack size for the thread pool worker threads. Implemented using QThread::stackSize. Task-number: QTBUG-2568 Change-Id: Ic7f3981289290685195bbaee977a23e0c3c49bf0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Make QThreadPoolPrivate use NSDMIsMorten Johan Sørvig2017-08-022-10/+6
| | | | | | | | | | | | | | | | | | | | | | (non static data member initializers) Also, taking the absolute value of the idealThreadCount() return value is no longer needed since the function now returns 1 for the "CPU detection failure" case. Change-Id: I2214fd15ed24413bba796ead38bbf1355dfd37d9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-041-13/+12
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * Switch QSemaphore::tryAcquire to using QDeadlineTimerAllan Sandfeld Jensen2017-07-021-13/+12
| | | | | | | | | | | | | | | | | | | | | | A deadline timer is more correct for timeouts. Also starts the timer before trying to acquire the mutex for more precise timeouts. Task-number: QTBUG-58745 Change-Id: I230266a3a5d7b7af33981efed4e6882e5727a41c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix typo in QMutex's free-list's Sizes[3]Edward Welbourne2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | A QFreeList's MaxIndex is clearly meant to be the sum of its Sizes; but the parentheses in MaxIndex - (16 - 128 - 1024) doesn't give the same as without the parentheses. Noticed while reviewing a copy of this code now used by QReadWriteLock (which has this fix). Change-Id: I9f68171475b3c6edc18896056b5532183fee92b2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QThread: Refine check for presence of std::futureFriedemann Kleint2017-05-291-2/+6
| | | | | | | | | | | | | | | | | | | | MinGW with win32 threads might not have _GLIBCXX_HAS_GTHREADS, so it needs to be checked. Amends change 597d4ff7962c0add87e4b93da4c366503d11aff5. Change-Id: I5c91d1dd3967c4922ced315b475d653b8b102ad6 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-073-0/+6
|\| | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkreply.cpp tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
| * QtCore: include mocsThiago Macieira2017-05-053-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compilation and link times in CPU seconds with GCC 7, using precompiled headers (not including moc, rcc, uic, etc. steps or headersclean): Before After Debug -O0 198,1 180,3 Debug -Og 240,7 229,2 Release -O3 267,1 249,2 Release LTO 239,4 229,8 QtCore required a little manual adjusting because some files are bootstrapped into moc itself and into qmake. Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | QThread: terminate on exceptions leaving run()Giuseppe D'Angelo2017-04-263-58/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Align ourselves to the Standard Library and call std::terminate if an exception leaves the thread entry point (that is, run()). On platforms using pthreads, thread cancellation needs to be taken in special consideration, since it looks like it was supported before. On Glibc, and when using C++, pthread_cancel and pthread_exit are implemented by throwing a special kind of exception that can be caught, but must always be rethrown. That exception is then used to activate the cancellation clean-up handlers. (This is non-Standard C++ behavior.) So: mimic what libstdc++'s std::thread does to support Glibc's pthread cancellation. At this time, it looks like libc++ has no support for this, and when used in combination with Glibc a thread cancellation results in a crash (also because it does not seem to terminate() when exceptions leave the thread). [ChangeLog][QtCore][QThread] An exception escaping from QThread::run() will now result in immediate and abnormal program termination. The same applies if an exception leaves a slot connected directly to the QThread::started() or QThread::finished() signals. Change-Id: I73cc93cf06c57018e149a578cc9d4cd0d6fc00ef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QThread: fix headersclean with C++17Marc Mutz2017-04-251-2/+2
| | | | | | | | | | | | | | | | | | | | GCC's -Wshadow complained about the re-use of 'args' as the parameter for the lambda. Fix by renaming it to largs (lambda-args) instead. Change-Id: Ia9e65b82b98ee56181d754868354988399496eef Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | QThread: add static create functionGiuseppe D'Angelo2017-04-242-0/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the spirit of std::thread, which takes a function to call and its parameters, and runs it in a new thread. Since the user might want to connect to signals, move QObjects into the new thread, etc., the new thread is not immediately started. Although technically all of this _should_ be implementable in pure C++11, there is nothing in the Standard to help us not reinvent all the plumbing: packing the decay'd parameters, storing them, invoking the function over the parameters (honoring INVOKE/std::invoke semantics). std::function does not do the job, as it's copiable and therefore does not support move-only functors; std::bind does not have INVOKE semantics. I certainly do not want to reimplement all the required facilities inside of Qt. Therefore, the full blown implementation requires C++17 (std::invoke). In order to make this useful also in pre-C++17, there are two additional implementations (C++11 and C++14) that support just a callable, without any arguments passed to it. The C++11 implementation makes use of a class to store and call the callable (even move-only ones); basically, it's what a closure type for a C++14 lambda would look like. An alternative implementation could've used some of the existing facilities inside QObject::connect implementation that store a functor (for the connect() overload connecting to free functions), namely: the QtPrivate::QFunctorSlotObject class. However: * QFunctorSlotObject does not support move-only callables (see QTBUG-60339); * QFunctorSlotObject itself is not a callable (apparently by design), and requires to be wrapped in a lambda that calls call() on it; * the moment QTBUG-60339 is solved, we'd need the same handwritten closure to keep QFunctorSlotObject working with move-only callabes. So: just use the handwritten one. The C++14 implementation is a simplified version of the C++11 one, actually using a generalized lambda capture (corresponding to the handwritten C++11 closure type). All three implementations use std::async (with a deferred launch policy, a nice use case for it!) under the hood. It's certainly an overkill for our use case, as we don't need the std::future, but at least std::async does all the plumbing for us. [ChangeLog][QtCore][QThread] Added the QThread::create function. Change-Id: I339d0be6f689df7d56766839baebda0aa2f7e94c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-201-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * Move Q_REQUIRED_RESULT to its correct positionThiago Macieira2017-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | That's before the return type or static, inline, constexpr or such keywords (if any). Perl Script: s/^(\s+)(.*) Q_REQUIRED_RESULT(;)?(\s*\/\/.*)?$/\1Q_REQUIRED_RESULT \2\3\4/ Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-203-65/+33
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
| * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-133-65/+33
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/network.pro mkspecs/features/mac/default_post.prf src/corelib/io/qfilesystemengine_win.cpp src/corelib/io/qprocess.cpp src/corelib/io/qprocess.h src/corelib/io/qprocess_p.h src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/corelib/thread/qmutex.cpp src/platformsupport/fontdatabases/windows/windows.pri src/plugins/platforms/eglfs/eglfsdeviceintegration.pro tests/auto/corelib/io/io.pro Change-Id: I8a27e0e141454818bba9c433200a4e84a88d147e
| | * Fix UB in QFutureInterface: invalid casts from ResultStoreBase to ResultStore<>Olivier Goffart2017-03-063-65/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ResultStore never actually exists, only ResutStoreBase does. So casting to ResultStore<T> and calling its member functions is UB. Put the type dependent function as template member functions within ResultStoreBase and so we don't need QtPrivate::ResultStore anymore. Same goes for the iterator. Change-Id: I739b9d234ba2238977863df77fde3a4471a9abd2 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * Doc: added info about return type for function QMutex::try_lock()Nico Vertriest2017-02-281-0/+3
| | | | | | | | | | | | | | | | | | | | | qmutex.cpp:266: warning: Undocumented return value Change-Id: Ib93a5a2505f663f266871dbe5582fb5856096889 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-021-3/+3
|\| | | | | | | | | | | Change-Id: I84097f8e7b3b2128028bd7693c913d6968b82bfe
| * | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-241-3/+3
| |\| | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/moc.prf Change-Id: Ia71c8e3b3185f7c999bf226d0675051b10b8740b
| | * QReadWriteLocker: Fix race in unlockOlivier Goffart2017-02-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An Acquire barrier in QReadWriteLocker::unlock was missing to synchronize with the testAndSetOrdered on d_ptr in the lock functions. The race is between the write of d->writerCount in tryLockForWrite, and the read in unlock. The acquire on d->mutex is not enough because it is not on the same object. While that race could be fixed by taking the newly-allocate()ed d's mutex before publishing it with testAndSet, there's another race, on 'recursive', between a newly-minted Private* with recursive == false in tryLockForWrite(), and the read of 'recursive' in unlock(). Task-number: QTBUG-58917 Change-Id: I10ba36573c0e57468d11e9b77d85045711feaea1 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-02-283-18/+38
|\| | | | | | | | | | | Change-Id: I7d84cfed0b2a122d334b8a920e6e4f18472d2f11
| * | QThreadPool: supersede cancel() with tryTake()Marc Mutz2017-02-223-18/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cancel() function added in 5b11e43e for Qt 5.5 suffers from a number of problems: First, if runnable->autoDelete() is true, then the function suffers from the ABA problem (see documentation written for trytake()). Second, if runnable->autoDelete() is false, due to cancel() throwing away crucial information instead of returning it, the caller cannot know whether the runnable was canceled (and thus has to be deleted), wasn't found or is currently executing (and thus mustn't be deleted), or has finished executing (and can be used to extract the result). Deprecate this dangerous API and replace it with the much more useful Private::stealRunnable(), promoted to public API and renamed to tryTake() for consistency with the rest of Qt. Described the various caveats in the function's documentation. [ChangeLog][QtCore][QThreadPool] The cancel() function suffers from several subtle issues and has been replaced with a new tryTake() function. Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Sprinkle Q_DECLARE_TYPEINFO on types used in containersGiuseppe D'Angelo2017-02-231-0/+2
| | | | | | | | | | | | | | | Change-Id: I6c71ed8c20cd5e785037ad25c2d3da8994e8e3a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-02-178-24/+23
|\| | | | | | | | | | | | | | | | | | | | Conflicts: qmake/Makefile.unix Change-Id: Ia18e391198222eef34ffa2df6f683e052058d032
| * | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-166-19/+17
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/plugin/qlibrary_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb