diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-18 11:45:07 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-18 11:45:08 +0100 |
commit | 18b69ae8a4cf8e2e536bfe9e81bd8d929eacf115 (patch) | |
tree | 32ff58219387fa5d3417038d8aaa4fce7bc14c36 /src/corelib | |
parent | 963c47aece12a0025707c76f6f8cb3de306752b8 (diff) | |
parent | 943cb0999dbbf1da99c1358b81ea3298ee116447 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia79c2457f20f3428ef1b4358c1094e8dc1bbc33e
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/text/UNICODE_LICENSE.txt | 19 | ||||
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 19 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/corelib/text/UNICODE_LICENSE.txt b/src/corelib/text/UNICODE_LICENSE.txt index 1c73202b74..567fda24dd 100644 --- a/src/corelib/text/UNICODE_LICENSE.txt +++ b/src/corelib/text/UNICODE_LICENSE.txt @@ -1,5 +1,20 @@ -Copyright © 1991-2018 Unicode, Inc. All rights reserved. -Distributed under the Terms of Use in http://www.unicode.org/copyright.html. +UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + +See Terms of Use for definitions of Unicode Inc.'s +Data Files and Software. + +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 1991-2019 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in https://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy of the Unicode data files and any associated documentation diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index a9352c3894..44cdf071df 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -534,7 +534,7 @@ void QThreadPool::start(std::function<void()> functionToRun, int priority) does nothing and returns \c false. Otherwise, \a runnable is run immediately using one available thread and this function returns \c true. - Note that the thread pool takes ownership of the \a runnable if + Note that on success the thread pool takes ownership of the \a runnable if \l{QRunnable::autoDelete()}{runnable->autoDelete()} returns \c true, and the \a runnable will be deleted automatically by the thread pool after the \l{QRunnable::run()}{runnable->run()} returns. If @@ -549,12 +549,7 @@ bool QThreadPool::tryStart(QRunnable *runnable) return false; Q_D(QThreadPool); - QMutexLocker locker(&d->mutex); - - if (d->allThreads.isEmpty() == false && d->activeThreadCount() >= d->maxThreadCount) - return false; - return d->tryStart(runnable); } @@ -571,7 +566,17 @@ bool QThreadPool::tryStart(std::function<void()> functionToRun) { if (!functionToRun) return false; - return tryStart(QRunnable::create(std::move(functionToRun))); + + Q_D(QThreadPool); + QMutexLocker locker(&d->mutex); + if (!d->allThreads.isEmpty() && d->activeThreadCount() >= d->maxThreadCount) + return false; + + QRunnable *runnable = QRunnable::create(std::move(functionToRun)); + if (d->tryStart(runnable)) + return true; + delete runnable; + return false; } /*! \property QThreadPool::expiryTimeout |