forked from qt-creator/qt-creator
Revert "Avoid starting threads from the wrong hosting thread"
This reverts commit 1421694d17
.
The commit broke e.g. Utils::mapReduce(....).results() in the main
thread. Since the main thread blocks, it cannot start a new thread.
Change-Id: I63abd07bcf002546740d0a7627f1fd2007c8b70c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
@@ -408,10 +408,7 @@ QFuture<ResultType> runAsync_internal(QThreadPool *pool,
|
|||||||
QFuture<ResultType> future = job->future();
|
QFuture<ResultType> future = job->future();
|
||||||
if (pool) {
|
if (pool) {
|
||||||
job->setThreadPool(pool);
|
job->setThreadPool(pool);
|
||||||
if (QThread::currentThread() == pool->thread())
|
pool->start(job);
|
||||||
pool->start(job);
|
|
||||||
else
|
|
||||||
QMetaObject::invokeMethod(pool, [pool, job]() { pool->start(job); }, Qt::QueuedConnection);
|
|
||||||
} else {
|
} else {
|
||||||
auto thread = new Internal::RunnableThread(job);
|
auto thread = new Internal::RunnableThread(job);
|
||||||
if (stackSize)
|
if (stackSize)
|
||||||
|
Reference in New Issue
Block a user