summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMika Salmela <mika.salmela@theqtcompany.com>2015-02-16 13:54:03 +0200
committerSean Harmer <sean.harmer@kdab.com>2015-02-19 17:08:33 +0000
commitcb7753f3ffa85eed0fbd98cb2e4f0e453c595d6d (patch)
treeb2394b4bf977d56a22f8035381353343d6ab5a83 /src
parentb7b9c97c54a58405fba017366236510650200b69 (diff)
Removes ThreadWeaver code from Qt3D
Qt3D will be published with commercial licenses and there can't be 3rd party LGPL code. This task will remove the ThreadWeaver code and places the adaptation code inside configuration. Change-Id: I316f23087cdd8fed0afafbb1a3d78e3ff159585a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/threadweaver/.reviewboardrc4
-rw-r--r--src/3rdparty/threadweaver/CMakeLists.txt59
-rw-r--r--src/3rdparty/threadweaver/COPYING.LIB510
-rw-r--r--src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in7
-rw-r--r--src/3rdparty/threadweaver/Mainpage.dox269
-rw-r--r--src/3rdparty/threadweaver/README.md9
-rw-r--r--src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp51
-rw-r--r--src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h44
-rw-r--r--src/3rdparty/threadweaver/autotests/AppendCharacterJob.h121
-rw-r--r--src/3rdparty/threadweaver/autotests/CMakeLists.txt76
-rw-r--r--src/3rdparty/threadweaver/autotests/DeleteTest.cpp108
-rw-r--r--src/3rdparty/threadweaver/autotests/DeleteTest.h63
-rw-r--r--src/3rdparty/threadweaver/autotests/JobTests.cpp1059
-rw-r--r--src/3rdparty/threadweaver/autotests/JobTests.h93
-rw-r--r--src/3rdparty/threadweaver/autotests/LifecycleTests.cpp116
-rw-r--r--src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp108
-rw-r--r--src/3rdparty/threadweaver/autotests/QueueTests.cpp206
-rw-r--r--src/3rdparty/threadweaver/autotests/QueueTests.h102
-rw-r--r--src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp65
-rw-r--r--src/3rdparty/threadweaver/autotests/run-n-tests.py76
-rw-r--r--src/3rdparty/threadweaver/benchmarks/CMakeLists.txt20
-rw-r--r--src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp306
-rw-r--r--src/3rdparty/threadweaver/doxygen-footer.html10
-rw-r--r--src/3rdparty/threadweaver/internal-doxygen.cfg1212
-rw-r--r--src/3rdparty/threadweaver/src/CMakeLists.txt82
-rw-r--r--src/3rdparty/threadweaver/src/collection.cpp326
-rw-r--r--src/3rdparty/threadweaver/src/collection.h129
-rw-r--r--src/3rdparty/threadweaver/src/debuggingaids.cpp39
-rw-r--r--src/3rdparty/threadweaver/src/debuggingaids.h163
-rw-r--r--src/3rdparty/threadweaver/src/dependency.cpp68
-rw-r--r--src/3rdparty/threadweaver/src/dependency.h54
-rw-r--r--src/3rdparty/threadweaver/src/dependencypolicy.cpp208
-rw-r--r--src/3rdparty/threadweaver/src/dependencypolicy.h109
-rw-r--r--src/3rdparty/threadweaver/src/destructedstate.cpp127
-rw-r--r--src/3rdparty/threadweaver/src/destructedstate_p.h69
-rw-r--r--src/3rdparty/threadweaver/src/exception.cpp56
-rw-r--r--src/3rdparty/threadweaver/src/exception.h64
-rw-r--r--src/3rdparty/threadweaver/src/executewrapper.cpp75
-rw-r--r--src/3rdparty/threadweaver/src/executewrapper_p.h60
-rw-r--r--src/3rdparty/threadweaver/src/executor.cpp55
-rw-r--r--src/3rdparty/threadweaver/src/executor_p.h56
-rw-r--r--src/3rdparty/threadweaver/src/iddecorator.cpp233
-rw-r--r--src/3rdparty/threadweaver/src/iddecorator.h105
-rw-r--r--src/3rdparty/threadweaver/src/inconstructionstate.cpp71
-rw-r--r--src/3rdparty/threadweaver/src/inconstructionstate_p.h59
-rw-r--r--src/3rdparty/threadweaver/src/job.cpp258
-rw-r--r--src/3rdparty/threadweaver/src/job.h227
-rw-r--r--src/3rdparty/threadweaver/src/jobinterface.h94
-rw-r--r--src/3rdparty/threadweaver/src/jobpointer.h33
-rw-r--r--src/3rdparty/threadweaver/src/lambda.h56
-rw-r--r--src/3rdparty/threadweaver/src/managedjobpointer.h49
-rw-r--r--src/3rdparty/threadweaver/src/qobjectdecorator.cpp65
-rw-r--r--src/3rdparty/threadweaver/src/qobjectdecorator.h67
-rw-r--r--src/3rdparty/threadweaver/src/queue.cpp263
-rw-r--r--src/3rdparty/threadweaver/src/queue.h100
-rw-r--r--src/3rdparty/threadweaver/src/queueapi.cpp38
-rw-r--r--src/3rdparty/threadweaver/src/queueapi_p.h65
-rw-r--r--src/3rdparty/threadweaver/src/queueing.h111
-rw-r--r--src/3rdparty/threadweaver/src/queueinterface.h177
-rw-r--r--src/3rdparty/threadweaver/src/queuepolicy.h86
-rw-r--r--src/3rdparty/threadweaver/src/queuesignals.cpp39
-rw-r--r--src/3rdparty/threadweaver/src/queuesignals.h76
-rw-r--r--src/3rdparty/threadweaver/src/queuestream.cpp98
-rw-r--r--src/3rdparty/threadweaver/src/queuestream.h63
-rw-r--r--src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp108
-rw-r--r--src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h80
-rw-r--r--src/3rdparty/threadweaver/src/sequence.cpp78
-rw-r--r--src/3rdparty/threadweaver/src/sequence.h60
-rw-r--r--src/3rdparty/threadweaver/src/shuttingdownstate.cpp70
-rw-r--r--src/3rdparty/threadweaver/src/shuttingdownstate_p.h63
-rw-r--r--src/3rdparty/threadweaver/src/state.cpp88
-rw-r--r--src/3rdparty/threadweaver/src/state.h107
-rw-r--r--src/3rdparty/threadweaver/src/suspendedstate.cpp65
-rw-r--r--src/3rdparty/threadweaver/src/suspendedstate_p.h56
-rw-r--r--src/3rdparty/threadweaver/src/suspendingstate.cpp70
-rw-r--r--src/3rdparty/threadweaver/src/suspendingstate_p.h59
-rw-r--r--src/3rdparty/threadweaver/src/thread.cpp129
-rw-r--r--src/3rdparty/threadweaver/src/thread.h106
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver.cpp29
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver.h41
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver.pri69
-rw-r--r--src/3rdparty/threadweaver/src/threadweaver_export.h6
-rw-r--r--src/3rdparty/threadweaver/src/weaver.cpp643
-rw-r--r--src/3rdparty/threadweaver/src/weaver_p.h162
-rw-r--r--src/3rdparty/threadweaver/src/weaverimplstate.cpp127
-rw-r--r--src/3rdparty/threadweaver/src/weaverimplstate_p.h85
-rw-r--r--src/3rdparty/threadweaver/src/weaverinterface_p.h56
-rw-r--r--src/3rdparty/threadweaver/src/workinghardstate.cpp82
-rw-r--r--src/3rdparty/threadweaver/src/workinghardstate_p.h58
-rw-r--r--src/3rdparty/threadweaver/threadweaver.yaml1
-rw-r--r--src/core/core.pro6
-rw-r--r--src/core/jobs/jobs.pri11
-rw-r--r--src/core/jobs/qaspectjobmanager.cpp22
-rw-r--r--src/core/jobs/qaspectjobmanager_p.h8
94 files changed, 31 insertions, 11381 deletions
diff --git a/src/3rdparty/threadweaver/.reviewboardrc b/src/3rdparty/threadweaver/.reviewboardrc
deleted file mode 100644
index 9822617dc..000000000
--- a/src/3rdparty/threadweaver/.reviewboardrc
+++ /dev/null
@@ -1,4 +0,0 @@
-REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
-REPOSITORY = 'git://anongit.kde.org/threadweaver'
-BRANCH = 'master'
-TARGET_GROUPS = 'kdeframeworks'
diff --git a/src/3rdparty/threadweaver/CMakeLists.txt b/src/3rdparty/threadweaver/CMakeLists.txt
deleted file mode 100644
index 8aee9378b..000000000
--- a/src/3rdparty/threadweaver/CMakeLists.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12)
-
-project(ThreadWeaver)
-
-find_package(ECM 0.0.9 REQUIRED NO_MODULE)
-
-set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
-
-
-include(KDEInstallDirs)
-include(KDEFrameworkCompilerSettings)
-include(KDECMakeSettings)
-
-set(REQUIRED_QT_VERSION 5.2.0)
-find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
-
-include(FeatureSummary)
-include(GenerateExportHeader)
-
-include(ECMSetupVersion)
-include(ECMGenerateHeaders)
-
-# -- Maintained by scripty
-set(KF5_VERSION "5.0.0")
-
-ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX THREADWEAVER
- VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/threadweaver_version.h"
- PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfigVersion.cmake")
-# --
-
-add_subdirectory(src)
-add_subdirectory(autotests)
-add_subdirectory(benchmarks)
-
-# create a Config.cmake and a ConfigVersion.cmake file and install them
-set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5ThreadWeaver")
-
-include(CMakePackageConfigHelpers)
-
-configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5ThreadWeaverConfig.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfig.cmake"
- INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
- )
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/threadweaver_version.h
- DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel )
-
-install(FILES
- "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfig.cmake"
- "${CMAKE_CURRENT_BINARY_DIR}/KF5ThreadWeaverConfigVersion.cmake"
- DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
- COMPONENT Devel
-)
-
-install(EXPORT KF5ThreadWeaverTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5ThreadWeaverTargets.cmake NAMESPACE KF5:: )
-
-if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
- feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
-endif()
diff --git a/src/3rdparty/threadweaver/COPYING.LIB b/src/3rdparty/threadweaver/COPYING.LIB
deleted file mode 100644
index 2d2d780e6..000000000
--- a/src/3rdparty/threadweaver/COPYING.LIB
+++ /dev/null
@@ -1,510 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in b/src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in
deleted file mode 100644
index 12b8f6ee7..000000000
--- a/src/3rdparty/threadweaver/KF5ThreadWeaverConfig.cmake.in
+++ /dev/null
@@ -1,7 +0,0 @@
-@PACKAGE_INIT@
-
-find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
-
-
-include("${CMAKE_CURRENT_LIST_DIR}/KF5ThreadWeaverTargets.cmake")
-
diff --git a/src/3rdparty/threadweaver/Mainpage.dox b/src/3rdparty/threadweaver/Mainpage.dox
deleted file mode 100644
index ed4e7b9bf..000000000
--- a/src/3rdparty/threadweaver/Mainpage.dox
+++ /dev/null
@@ -1,269 +0,0 @@
-/** \mainpage ThreadWeaver
-
-<p><b>
-Overview |
-\ref UseCases |
-\ref Why |
-\ref MainComponents "Main Components"
-</b></p>
-
-ThreadWeaver is a helper for multithreaded programming. It uses a job-based
-interface to queue tasks and execute them in an efficient way.
-
-You simply divide the workload into jobs, state the dependencies between the jobs
-and ThreadWeaver will work out the most efficient way of dividing the work between
-threads within a set of resource limits.
-
-For more information, see \ref UseCases, \ref Why and \ref MainComponents.
-
-\section Tests Example Code
-<p>Example code is available in the
-<a href="http://lxr.kde.org/source/kde/kdelibs/threadweaver/Examples/">Examples</a>
-directory. The Construction
-program shows how to use ThreadWeaver in imperative (not event oriented)
-programs. The Jobs program provides a GUI example and displays the
-interaction with the weaver state and it's signals. The Simple
-Multithreaded Image Viewer (SMIV) example shows the use of job
-dependencies.</p>
-
-\authors
-Mirko Boehm
-
-\maintainers
-Mirko Boehm
-
-\licenses
-\lgpl
-
-
-*/
-
-/** \page UseCases Use Cases
-
-<p><b>
-\ref index "Overview" |
-Use Cases |
-\ref Why |
-\ref MainComponents "Main Components"
-</b></p>
-
-<p>ThreadWeaver provides a solution to a number (but not all)
-multithreading problems. Let's have a look:</p>
-
-<ul> <li>How do you implement a single operation that takes a lot of CPU
-power, but is hard to handle in chunks (Example: scale an image) when
-you want your GUI to remain responsive? Encapsulate the operation in a
-class object derived from Job instead of a method and put it in the
-static instance (Weaver::instance). Connect to the Job's done() signal
-to receive a notification when it is completed.</li>
-
-<li>How do you implement a CPU intensive operation while time-critical
-operations are executed (load and decode an MP3 while another one is fed
-to the audio device): Implement both the file loading operation and the
-play operation in a job and queue both at the same time. There is also a
-synchronous sleep method in the Job class if a job needs to be delayed
-for a number of milliseconds after it is taken over by a thread.</li>
-
-<li>How do you implement many small operations where the cost of each
-individual one is hard to estimate (loading two hundred icons from an
-NFS drive): Create a common or a number of specialized job
-classes. Queue all of them. Either connect to the individual done signal
-to process every item when it has been finished or connect to
-Weaver::jobsDone() to receive a notification when all of the jobs are
-done.</li>
-
-<li>How do you implement an operation with complex control flow and
-dependencies in the execution order (load, parse and display an HTML
-document with embedded media): Create jobs for the individual steps you
-need to perform. Try to split the whole operation in as many
-independent, parallelizable parts as possible. Now declare the execution
-dependencies. A job will only be executed when all jobs it depends on
-are finished. This way every individual operation will be executed as
-soon as it becomes possible. Connect to the final jobs done() signal to
-be notified when all parts of the whole operations have been
-executed. If necessary (if there is more than one final object), create a
-dummy job object that depends on all of them to have one central end
-point of execution.</li> </ul>
-
-<p>As you can see, ThreadWeaver can provide solutions for simple, but
-also for complex cases. For an example on how job dependencies can be
-modeled and used to create elegant, streamlined solutions for control
-flow modeling, see the Simple Multithreaded Image Viewer (SMIV) example
-in the Tests directory.</p>
-
-<p>ThreadWeaver focuses on operations that can be implemented in
-Jobs. To create solutions where a thread is supposed to constantly run
-to perform an ongoing operation that, for example, spans the whole
-application live, it has to be verified that it is the right
-approach. It is possible to add very long or neverending operations to
-the queue, but it will constantly bind a thread to that operation. It
-might still make sense to use ThreadWeaver, as the creation, handling
-and destruction of the threads is already taken care of, but the minimum
-inventory size (thread count) should be increased accordingly to provide
-for enough threads to process the other jobs.</p>
-
-*/
-
-/** \page Why Why Multithreading?
-
-<p><b>
-\ref index "Overview" |
-\ref UseCases |
-Why Multithreading? |
-\ref MainComponents "Main Components"
-</b></p>
-
-<p>In the past, multithreading has been considered a powerful tool that
-is hard to handle (some call it the work of the devil). While there may
-be some truth to this, newer tools have made the job of the software
-developer much easier when creating parallel implementations of
-algorithms. At the same time, the necessity to use multiple threads to
-create performant applications has become more and more
-clear. Technologies like Hyperthreading and multiple core processors can
-only be used if processors have to schedule processing power to
-multiple, concurrently running processes or threads.</p>
-
-<p>Event driven programs especially bear the issue of latency, which is
-more important for the user's impression of application performance than
-other factors. But the responsiveness of the user interface relies
-mainly on the ability of the application to process events, an ability
-that is much limited in case the application is executing processing
-power expensive, lengthy operations. This leads, for example, to delayed
-or sluggish processing of necessary paint events. Even if this does not
-at all influence the total time necessary to perform the operation the
-user requested, is is annoying and not state of the art. </p>
-
-<p>There are different approaches to solve this issue. The crudest one
-may be to process single or multiple events while performing a lengthy
-operation, which may or may not work sufficiently, but is at least sure
-to ruin all efforts of Separation of Concerns. Concerns can simply not
-be separated if the developer has to intermingle instructions with event
-handling where he does not even know about the kind of events that are
-processed. </p>
-
-<p>Another approach is to use event-controlled asynchronous
-operations. This is sufficient in most cases, but still causes a number
-of issues. Any operation that carries the possibility of taking a long
-time or blocking may still stop event processing for a while. Such risks
-are hard to assess, and especially hard to test in laboratory
-environments where networks are fast and reliable and the system I/O
-load is generally low. Network operations may fail. Hard disks may be
-suspended. The I/O subsystem may be so busy that transfering 2 kByte may
-take a couple of seconds. </p>
-
-<p>Processing events in objects that are executed in other threads is
-another approach. It has it's own issues that come with parallel
-programming, but it makes sure the main event loop returns as soon as
-possible. Usually this approach is combined with a state pattern to
-synchronize the GUI with the threaded event processing. </p>
-
-<p>Which one of these approaches is suitable for a specific case has to
-be assessed by the application developers. There is no silver
-bullet. All have specific strengths, weaknesses and issues. The
-ThreadWeaver library provides the means to implement multithreaded job
-oriented solutions. </p>
-
-<p>To create performant applications, the application designers have to
-leverage the functionality provided by the hardware platform as good as
-possible. While code optimizations only lead to so much improvement,
-application performance is usually determined by network and I/O
-throughput. The CPU time needed is usually negligible. At the same time,
-the different hardware subsystems usually are independent in modern
-architectures. Network, I/O and memory interfaces can transfer data all
-at the same time, and the CPU is able to process instructions while all
-these subsystems are busy. The modern computer is not a traditional
-uniprocessor (think of GPUs, too). This makes it necessary to use all
-these parallel subsystems at the same time as much as possible to
-actually use the possibilities modern hardware provides, which is very
-hard to achieve in a single thread.</p>
-
-<p>Another very important issue is application processing
-flow. Especially GUI applications to not follow the traditional
-imperative programming pattern. Execution flow is more network-like,
-with chunks of code that depend on others to finish processing before
-they can touch their data. Tools to represent those
-networks to set up your applications order of execution are rare, and
-usually leave it to the developers to code the execution order of the
-instructions. This solutions are usually not flexible and do not adapt
-to the actual usage of the CPU nodes and computer
-subsystems. ThreadWeaver provides means to represent code execution
-dependencies and relies on the operating systems scheduler to actually
-distribute the work load. The result is an implementation that is very
-close to the original application semantics, and usually improved
-performance and scalability in different real-life scenarios. </p>
-
-<p>The more tasks are handled in parallel, the more memory is
-necessary. There is a permanent CPU - memory tradeoff which limits the
-number of parallel operations to the extend where memory that needs to
-be swapped in and out slows down the operations. Therefore memory usage
-needs to be equalized to allow the processors to operate without being
-slowed down. This means parallel operations need to be scheduled to a
-limit to balance CPU and memory usage. ThreadWeaver provides the means
-for that. </p>
-
-<p>In general, ThreadWeaver tries to make to task of creating
-multithreaded, performant applications as simple as
-possible. Programmers should be relieved of synchronization, execution
-dependendancy and load balancing issues as much as possible. The API
-tends to be clean, extensible and easy to understand. </p>
-
-*/
-
-/** \page MainComponents Main Components of ThreadWeaver
-
-<p><b>
-\ref index "Overview" |
-\ref UseCases |
-\ref Why |
-Main Components
-</b></p>
-
-<p>ThreadWeaver is a Job queue. It executes jobs in threads it
-internally manages. The minimum and maximum number of threads provided
-by a Weaver is set by the user. Jobs are regular QObjects, which allows
-users to connect to the done() signal to be notified when the Job has
-been executed. The Weaver class provides objects that handle a number of
-threads called the inventory. Users usually acquire a reference to a
-WeaverInterface object. </p>
-
-<p>Jobs may depend on other jobs. A job will only execute if all jobs it
-depends on are already finished. In this, dependencies reorder job
-execution. If no dependencies are declared, jobs are executed in
-queueing order. Multiple dependencies are possible, which allows the
-creation of complex flow graphs that are automatically executed by the
-Weaver. It is important, though, to avoid circular dependencies. Two
-jobs that depend on each other in both directions will simply never be
-executed, since the dependencies will never resolve.</p>
-
-<p>Threads are created on demand and do not exit until the containing
-weaver is deleted. Threads have an eager policy in trying to execute
-jobs out of the queue. The managing Weaver blocks them if no jobs are
-availabe.</p>
-
-<p>WeaverObservers are used to receive more informative events about the
-thread states and job execution. They can be used to provide progress or
-debugging information or to implement GUIs to show the thread
-activity. Observers can be attached to Weavers and will disconnect
-automatically when they are deleted.</p>
-
-\section Job Execution
-
-<p>In general, jobs are executed in the order they are queued, if they
-have no unresolved dependencies. This behaviour can be used to balance
-I/O, network and CPU load. The SMIV example shows how this can be done.
-</p>
-
-\section Emitting Signals from Jobs
-<p>To notify the application's GUI of progress or other events, it may
-be desirable to emit signals from the Job objects that can be connected
-to the main thread. Since the job will be executed in another thread,
-such signals are delivered asynchronously.</p>
-
-<p>The Job class in the ThreadWeaver library itself contains such a
-helper class that can be used as a reference for this approach.</p>
-
-*/
-
-// DOXYGEN_SET_PROJECT_NAME = ThreadWeaver
-// DOXYGEN_EXCLUDE = Examples Experimental Tests Docs Scripts WeaverGui
-// vim:ts=4:sw=4:expandtab:filetype=doxygen
diff --git a/src/3rdparty/threadweaver/README.md b/src/3rdparty/threadweaver/README.md
deleted file mode 100644
index 3805fddc0..000000000
--- a/src/3rdparty/threadweaver/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-
-## Introduction
-
-## Links
-
-- Mailing list: <https://mail.kde.org/mailman/listinfo/kde-frameworks-devel>
-- IRC channel: #kde-devel on Freenode
-- Git repository: <https://projects.kde.org/projects/frameworks/threadweaver/repository>
diff --git a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp b/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp
deleted file mode 100644
index 53b299598..000000000
--- a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- C++ -*-
-
- Helper class for unit tests.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "AppendCharacterAndVerifyJob.h"
-
-AppendCharacterAndVerifyJob::AppendCharacterAndVerifyJob()
- : AppendCharacterJob()
-{
-}
-
-void AppendCharacterAndVerifyJob::setValues(QChar c, QString *stringref, const QString &expected)
-{
- AppendCharacterJob::setValues(c, stringref);
- m_expected = expected;
-}
-
-void AppendCharacterAndVerifyJob::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
-{
- using namespace ThreadWeaver;
- QMutexLocker locker(&s_GlobalMutex);
- stringRef()->append(character());
- if (m_expected.mid(0, stringRef()->length()) != *stringRef()) {
- debug(3, "It broke!");
- }
- debug(3, "AppendCharacterJob::run: %c appended, result is %s.\n",
- character().toLatin1(), qPrintable(*stringRef()));
-}
diff --git a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h b/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h
deleted file mode 100644
index 5e7bddf8a..000000000
--- a/src/3rdparty/threadweaver/autotests/AppendCharacterAndVerifyJob.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- C++ -*-
-
- Helper class for unit tests.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef APPENDCHARACTERANDVERIFYJOB_H
-#define APPENDCHARACTERANDVERIFYJOB_H
-
-#include <AppendCharacterJob.h>
-
-class AppendCharacterAndVerifyJob : public AppendCharacterJob
-{
-public:
- AppendCharacterAndVerifyJob();
- void setValues(QChar character, QString *stringref, const QString &expected);
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *);
-
-private:
- QString m_expected;
-};
-
-#endif // APPENDCHARACTERANDVERIFYJOB_H
diff --git a/src/3rdparty/threadweaver/autotests/AppendCharacterJob.h b/src/3rdparty/threadweaver/autotests/AppendCharacterJob.h
deleted file mode 100644
index cfc625b15..000000000
--- a/src/3rdparty/threadweaver/autotests/AppendCharacterJob.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- C++ -*-
-
- Helper class for unit tests.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef APPENDCHARACTER_JOB
-#define APPENDCHARACTER_JOB
-
-#include <QtCore/QObject>
-#include <QtCore/QMutex>
-
-#include <ThreadWeaver/JobPointer>
-#include <ThreadWeaver/Job>
-#include <ThreadWeaver/DebuggingAids>
-
-// define in test binary:
-
-extern QMutex s_GlobalMutex;
-
-class AppendCharacterJob : public ThreadWeaver::Job
-{
-public:
- AppendCharacterJob(QChar c = QChar(), QString *stringref = 0)
- : ThreadWeaver::Job()
- {
- setValues(c, stringref);
- }
-
- void setValues(QChar c, QString *stringref)
- {
- m_c = c;
- m_stringref = stringref;
- }
-
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
- {
- QMutexLocker locker(&s_GlobalMutex);
- m_stringref->append(m_c);
- using namespace ThreadWeaver;
- debug(3, "AppendCharacterJob::run: %c appended, result is %s.\n",
- m_c.toLatin1(), qPrintable(*m_stringref));
- }
-
- QChar character() const
- {
- return m_c;
- }
-
-protected:
- QString *stringRef() const
- {
- return m_stringref;
- }
-
-private:
- QChar m_c;
- QString *m_stringref;
-};
-
-class FailingAppendCharacterJob : public AppendCharacterJob
-{
-public:
- FailingAppendCharacterJob(QChar c = QChar(), QString *stringref = 0)
- : AppendCharacterJob(c, stringref)
- {
- }
-
- bool success() const
- {
- return false;
- }
-};
-
-class BusyJob : public ThreadWeaver::Job
-{
-public:
- BusyJob()
- : ThreadWeaver::Job()
- {
- }
-
- ~BusyJob()
- {
-// using namespace ThreadWeaver;
-// debug(0, "~BusyJob\n");
- }
-
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
- {
-// debug(0, "BusyJob: entered run()\n");
- for (int i = 0; i < 100; ++i) {
- int k = (i << 3) + (i >> 4);
- Q_UNUSED(k);
- }
- }
-};
-
-#endif
-
diff --git a/src/3rdparty/threadweaver/autotests/CMakeLists.txt b/src/3rdparty/threadweaver/autotests/CMakeLists.txt
deleted file mode 100644
index 4cdaddfbe..000000000
--- a/src/3rdparty/threadweaver/autotests/CMakeLists.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-find_package(Qt5Test 5.2.0 REQUIRED NO_MODULE)
-
-remove_definitions(-DQT_NO_CAST_FROM_ASCII)
-add_definitions(-fexceptions)
-
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/../src/ThreadWeaver/
-)
-
-include(ECMMarkAsTest)
-
-########### next target ###############
-
-set(JobTests_SRCS JobTests.cpp AppendCharacterAndVerifyJob.cpp)
-
-add_executable(ThreadWeaverJobTests ${JobTests_SRCS})
-add_test(ThreadWeaverJobTests ThreadWeaverJobTests)
-ecm_mark_as_test(ThreadWeaverJobTests)
-
-target_link_libraries(ThreadWeaverJobTests Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverJobTests PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(QueueTests_SRCS QueueTests.cpp)
-
-add_executable(ThreadWeaverQueueTests ${QueueTests_SRCS})
-add_test(ThreadWeaverQueueTests ThreadWeaverQueueTests)
-ecm_mark_as_test(ThreadWeaverQueueTests)
-
-target_link_libraries(ThreadWeaverQueueTests Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverQueueTests PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(DeleteTest_SRCS DeleteTest.cpp)
-
-add_executable(ThreadWeaverDeleteTest ${DeleteTest_SRCS})
-add_test(ThreadWeaverDeleteTest ThreadWeaverDeleteTest)
-ecm_mark_as_test(ThreadWeaverDeleteTest)
-
-target_link_libraries(ThreadWeaverDeleteTest Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverDeleteTest PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(LifecycleTest_SRCS LifecycleTests.cpp)
-
-add_executable(ThreadWeaverLifecycleTest ${LifecycleTest_SRCS})
-add_test(ThreadWeaverLifecycleTest ThreadWeaverLifecycleTest)
-ecm_mark_as_test(ThreadWeaverLifecycleTest)
-
-target_link_libraries(ThreadWeaverLifecycleTest Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverLifecycleTest PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(ShutdownOnQApplicationQuitTest_SRCS ShutdownOnQApplicationQuitTests.cpp)
-
-add_executable(ThreadWeaverShutdownOnQApplicationQuitTest ${ShutdownOnQApplicationQuitTest_SRCS})
-add_test(ThreadWeaverShutdownOnQApplicationQuitTest ThreadWeaverShutdownOnQApplicationQuitTest)
-ecm_mark_as_test(ThreadWeaverShutdownOnQApplicationQuitTest)
-
-target_link_libraries(ThreadWeaverShutdownOnQApplicationQuitTest Qt5::Test KF5::ThreadWeaver)
-set_target_properties(ThreadWeaverShutdownOnQApplicationQuitTest PROPERTIES MACOSX_BUNDLE FALSE)
-
-########### next target ###############
-
-set(QueueFactoryTest_SRCS QueueFactoryTests.cpp)
-
-add_executable(ThreadWeaverQueueFactoryTest ${QueueFactoryTest_SRCS})
-add_test(ThreadWeaverQueueFactoryTest ThreadWeaverQueueFactoryTest)
-ecm_mark_as_test(ThreadWeaverQueueFactoryTest)
-
-target_link_libraries(ThreadWeaverQueueFactoryTest Qt5::Test KF5::ThreadWeaver)
-Set_target_properties(ThreadWeaverQueueFactoryTest PROPERTIES MACOSX_BUNDLE FALSE)
diff --git a/src/3rdparty/threadweaver/autotests/DeleteTest.cpp b/src/3rdparty/threadweaver/autotests/DeleteTest.cpp
deleted file mode 100644
index 6b5103aaa..000000000
--- a/src/3rdparty/threadweaver/autotests/DeleteTest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for the memory management in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <QEventLoop>
-
-#include "DeleteTest.h"
-
-#include <ThreadWeaver/JobPointer>
-#include <ThreadWeaver/QObjectDecorator>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/DebuggingAids>
-
-#include "AppendCharacterJob.h"
-
-class InstanceCountingSequence : public Sequence
-{
-public:
- explicit InstanceCountingSequence()
- : Sequence()
- {
- instances_.fetchAndAddAcquire(1);
- }
-
- ~InstanceCountingSequence()
- {
- instances_.fetchAndAddAcquire(-1);
- }
-
- static int instances()
- {
- return instances_.loadAcquire();
- }
-
-private:
- static QAtomicInt instances_;
-};
-
-QAtomicInt InstanceCountingSequence::instances_;
-
-DeleteTest::DeleteTest()
-{
- ThreadWeaver::setDebugLevel(true, 1);
- ThreadWeaver::Queue::instance()->setMaximumNumberOfThreads(4);
-}
-
-void DeleteTest::DeleteSequenceTest()
-{
- const int NumberOfSequences = 100;
- ThreadWeaver::Queue::instance()->suspend();
- for (int i = 0; i < NumberOfSequences; ++i) {
- QJobPointer seq(new QObjectDecorator(new InstanceCountingSequence));
- seq->sequence()->addJob(JobPointer(new BusyJob));
- seq->sequence()->addJob(JobPointer(new BusyJob));
- QVERIFY(connect(seq.data(), SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(deleteSequence(ThreadWeaver::JobPointer))));
-
- ThreadWeaver::Queue::instance()->enqueue(seq);
- m_finishCount.fetchAndAddRelease(1);
- }
- QCOMPARE(m_finishCount.loadAcquire(), NumberOfSequences);
- QEventLoop loop;
- QVERIFY(connect(this, SIGNAL(deleteSequenceTestCompleted()), &loop, SLOT(quit()), Qt::QueuedConnection));
- ThreadWeaver::Queue::instance()->resume();
- ThreadWeaver::Queue::instance()->finish();
- loop.exec();
- QCOMPARE(m_finishCount.loadAcquire(), 0);
- // The used Weaver instance needs to be shut down. The threads may still hold a reference to the previous job while
- // waiting for the next one or blocking because the queue is empty. If all threads have exited, no references to any jobs are
- // held anymore.
- ThreadWeaver::Queue::instance()->shutDown();
- QCOMPARE(InstanceCountingSequence::instances(), 0);
-}
-
-void DeleteTest::deleteSequence(ThreadWeaver::JobPointer)
-{
- if (m_finishCount.fetchAndAddRelease(-1) == 1) { // if it *was* 1...
- emit deleteSequenceTestCompleted();
- }
-}
-
-QMutex s_GlobalMutex;
-
-QTEST_MAIN(DeleteTest)
-
diff --git a/src/3rdparty/threadweaver/autotests/DeleteTest.h b/src/3rdparty/threadweaver/autotests/DeleteTest.h
deleted file mode 100644
index fe006014c..000000000
--- a/src/3rdparty/threadweaver/autotests/DeleteTest.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for the memory management in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef DELETETEST_H
-#define DELETETEST_H
-
-#include <QtCore/QObject>
-#include <QtTest/QtTest>
-#include <QAtomicInt>
-
-#include <ThreadWeaver/JobPointer>
-
-namespace ThreadWeaver
-{
-class Job;
-}
-
-using namespace ThreadWeaver;
-
-class DeleteTest : public QObject
-{
- Q_OBJECT
-public:
- DeleteTest();
-
-private Q_SLOTS:
- void DeleteSequenceTest();
-
-public Q_SLOTS: // not a test!
- void deleteSequence(ThreadWeaver::JobPointer job);
-
-Q_SIGNALS:
- void deleteSequenceTestCompleted();
-
-private:
- QAtomicInt m_finishCount;
-};
-
-#endif
diff --git a/src/3rdparty/threadweaver/autotests/JobTests.cpp b/src/3rdparty/threadweaver/autotests/JobTests.cpp
deleted file mode 100644
index 785776b17..000000000
--- a/src/3rdparty/threadweaver/autotests/JobTests.cpp
+++ /dev/null
@@ -1,1059 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for job processing in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "JobTests.h"
-
-#include <cstdlib>
-
-#include <QtCore/QMutex>
-#include <QtTest/QtTest>
-#include <QSignalSpy>
-
-#include <ThreadWeaver/Queueing>
-#include <ThreadWeaver/QueueStream>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/Lambda>
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/Thread>
-#include <ThreadWeaver/DebuggingAids>
-#include <ThreadWeaver/Collection>
-#include <ThreadWeaver/ResourceRestrictionPolicy>
-#include <ThreadWeaver/Dependency>
-#include <ThreadWeaver/DependencyPolicy>
-#include <ThreadWeaver/QObjectDecorator>
-#include <ThreadWeaver/Exception>
-
-#include "AppendCharacterJob.h"
-#include "AppendCharacterAndVerifyJob.h"
-
-QMutex s_GlobalMutex;
-
-using namespace ThreadWeaver;
-
-//Ensure that after the object is created, the weaver is idle and resumed.
-//Upon destruction, ensure the weaver is idle and suspended.
-class WaitForIdleAndFinished
-{
-public:
- explicit WaitForIdleAndFinished(Queue *weaver)
- : weaver_(weaver)
- {
- Q_ASSERT(weaver);
- weaver_->finish();
- Q_ASSERT(weaver_->isIdle());
- weaver_->resume();
- }
-
- ~WaitForIdleAndFinished()
- {
- weaver_->resume();
- weaver_->dequeue();
- weaver_->finish();
- weaver_->suspend();
- Q_ASSERT(weaver_->isIdle());
- }
-private:
- Queue *weaver_;
-};
-
-void JobTests::initTestCase()
-{
- setDebugLevel(true, 1);
-}
-
-// Call finish() before leaving a test or use a WaitForIdleAndFinished object to make sure the queue is empty
-// and in an idle state.
-
-void JobTests::WeaverLazyThreadCreationTest()
-{
- Queue weaver;
- QString sequence;
-
- WaitForIdleAndFinished w(&weaver);
- Q_ASSERT(weaver.isIdle());
- QCOMPARE(weaver.currentNumberOfThreads(), 0);
- weaver.stream() << new AppendCharacterJob(QChar('a'), &sequence);
- weaver.finish();
- QCOMPARE(weaver.currentNumberOfThreads(), 1);
- Q_ASSERT(weaver.isIdle());
-}
-
-void JobTests::SimpleJobTest()
-{
- QString sequence;
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << new AppendCharacterJob(QChar('1'), &sequence);
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("1"));
-}
-
-void JobTests::SimpleJobCollectionTest()
-{
- QString sequence;
- Collection jobCollection;
- jobCollection << new AppendCharacterJob(QChar('a'), &sequence)
- << new AppendCharacterJob(QChar('b'), &sequence)
- << new AppendCharacterJob(QChar('c'), &sequence);
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << jobCollection;
-
- Queue::instance()->finish();
-
- QVERIFY(sequence.length() == 3);
- QVERIFY(sequence.count('a') == 1);
- QVERIFY(sequence.count('b') == 1);
- QVERIFY(sequence.count('c') == 1);
-}
-
-void JobTests::EmptyJobCollectionTest()
-{
- Collection collection;
-
- WaitForIdleAndFinished w(Queue::instance());
- Q_ASSERT(Queue::instance()->isIdle());
- stream() << collection;
- Queue::instance()->finish();
- QVERIFY(collection.isFinished());
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::CollectionQueueingTest()
-{
- QString output;
- Collection jobCollection;
- jobCollection << new AppendCharacterJob(QChar('a'), &output)
- << new AppendCharacterJob(QChar('b'), &output)
- << new AppendCharacterJob(QChar('c'), &output);
-
- Queue weaver;
- WaitForIdleAndFinished w(&weaver);
- weaver.suspend();
- weaver.stream() << jobCollection;
- QCOMPARE(weaver.queueLength(), 1); //collection queues itself, and it's elements upon execution of self
- weaver.resume();
- weaver.finish();
- QCOMPARE(output.length(), 3);
- QVERIFY(Queue::instance()->isIdle());
-}
-
-namespace
-{
-using namespace ThreadWeaver;
-
-QString SequenceTemplate = "abcdefghijklmnopqrstuvwxyz";
-
-class GeneratingCollection : public Collection
-{
-public:
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- std::for_each(SequenceTemplate.cbegin(), SequenceTemplate.cend(),
- [this](QChar it)
- {
- *this << new AppendCharacterJob(it, &sequence_);
- });
- }
- QString sequence_;
-};
-
-class GeneratingSequence : public Sequence
-{
-public:
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- std::for_each(SequenceTemplate.cbegin(), SequenceTemplate.cend(),
- [this](QChar it)
- {
- *this << new AppendCharacterJob(it, &sequence_);
- });
- }
- QString sequence_;
-};
-
-}
-
-void JobTests::GeneratingCollectionTest()
-{
- using namespace ThreadWeaver;
-
- GeneratingCollection collection;
- WaitForIdleAndFinished w(Queue::instance());
- stream() << make_job_raw(&collection);
- Queue::instance()->finish();
- QCOMPARE(collection.sequence_.count(), SequenceTemplate.length());
-}
-
-void JobTests::ShortJobSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Sequence> jobSequence(new Sequence());
- jobSequence->addJob(jobA);
- jobSequence->addJob(jobB);
- jobSequence->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->enqueue(jobSequence);
- // Job::DumpJobDependencies();
- Queue::instance()->finish();
- QCOMPARE(sequence, QLatin1String("abc"));
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::EmptyJobSequenceTest()
-{
- using namespace ThreadWeaver;
- QObjectDecorator sequence(new Sequence());
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- Q_ASSERT(Queue::instance()->isIdle());
- QSignalSpy doneSignalSpy(&sequence, SIGNAL(done(ThreadWeaver::JobPointer)));
- QCOMPARE(doneSignalSpy.count(), 0);
- enqueue_raw(&sequence);
- Queue::instance()->finish();
- QVERIFY(sequence.isFinished());
- QVERIFY(Queue::instance()->isIdle());
- QCOMPARE(doneSignalSpy.count(), 1);
-}
-
-void JobTests::GeneratingSequenceTest()
-{
- using namespace ThreadWeaver;
-
- GeneratingSequence sequence;
- WaitForIdleAndFinished w(Queue::instance());
- stream() << make_job_raw(&sequence);
- Queue::instance()->finish();
- QCOMPARE(sequence.sequence_, SequenceTemplate);
-}
-
-/** This test verifies that the done signal for a collection is only sent after all element of the collection have completed. */
-void JobTests::IncompleteCollectionTest()
-{
- using namespace ThreadWeaver;
-
- QString result;
- QObjectDecorator jobA(new AppendCharacterJob(QChar('a'), &result));
- AppendCharacterJob jobB(QChar('b'), &result); //jobB does not get added to the sequence and queued
- QObjectDecorator col(new Collection());
- *col.collection() << jobA;
-
- WaitForIdleAndFinished w(Queue::instance());
- DependencyPolicy::instance().addDependency(Dependency(&jobA, &jobB));
- QSignalSpy collectionDoneSignalSpy(&col, SIGNAL(done(ThreadWeaver::JobPointer)));
- QSignalSpy jobADoneSignalSpy(&jobA, SIGNAL(done(ThreadWeaver::JobPointer)));
- QCOMPARE(collectionDoneSignalSpy.count(), 0);
- QCOMPARE(jobADoneSignalSpy.count(), 0);
- enqueue_raw(&col);
- Queue::instance()->resume();
- QCoreApplication::processEvents();
- QCOMPARE(collectionDoneSignalSpy.count(), 0);
- QCOMPARE(jobADoneSignalSpy.count(), 0);
- DependencyPolicy::instance().removeDependency(Dependency(&jobA, &jobB));
- Queue::instance()->finish();
- QCoreApplication::processEvents();
- QVERIFY(col.collection()->isFinished());
- QVERIFY(Queue::instance()->isIdle());
- QCOMPARE(collectionDoneSignalSpy.count(), 1);
- QCOMPARE(jobADoneSignalSpy.count(), 1);
-}
-
-/** This test verifies that started() is emitted for a collection at the time the first of any elements of the collection gets
- * executed. */
-void JobTests::EmitStartedOnFirstElementTest()
-{
- using namespace ThreadWeaver;
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- QString result;
-
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &result));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &result));
- QObjectDecorator collection(new Collection());
- Collection *decorated = dynamic_cast<Collection *>(collection.job());
- QVERIFY(decorated != 0);
- decorated->addJob(jobA);
- decorated->addJob(jobB);
-
- enqueue(make_job_raw(&collection));
- QSignalSpy collectionStartedSignalSpy(&collection, SIGNAL(started(ThreadWeaver::JobPointer)));
- QSignalSpy collectionDoneSignalSpy(&collection, SIGNAL(done(ThreadWeaver::JobPointer)));
- Queue::instance()->resume();
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QVERIFY(collection.isFinished());
- QCOMPARE(result.length(), 2);
- for (int i = 0; i < 100; ++i) {
- if (collectionStartedSignalSpy.count() != 0 && collectionDoneSignalSpy.count() != 0) {
- break;
- }
- QTest::qWait(1);
- debug(2, "JobTests::EmitStartedOnFirstElementTest: waiting (%i)\n", i);
- qApp->processEvents();
- }
- QCOMPARE(collectionStartedSignalSpy.count(), 1);
- QCOMPARE(collectionDoneSignalSpy.count(), 1);
- QVERIFY(Queue::instance()->isIdle());
-}
-
-/* This test verifies that all elements of a collection are only executed after all dependencies for the collection
- * itself have been resolved.
- * Previous tests have already verified that collections without dependencies get executed right away. */
-void JobTests::CollectionDependenciesTest()
-{
- using namespace ThreadWeaver;
-
- QString result;
- // set up a collection that depends on jobC which does not get queued
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &result));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &result));
- QObjectDecorator col(new Collection());
- QSignalSpy collectionStartedSignalSpy(&col, SIGNAL(started(ThreadWeaver::JobPointer)));
- col.collection()->addJob(jobA);
- col.collection()->addJob(jobB);
- QEventLoop loop;
- connect(&col, SIGNAL(started(ThreadWeaver::JobPointer)), &loop, SLOT(quit()));
-
- QSharedPointer<AppendCharacterJob> jobC(new AppendCharacterJob(QChar('c'), &result));
- DependencyPolicy::instance().addDependency(Dependency(&col, jobC));
-
- // queue collection, but not jobC, the collection should not be executed
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- Queue::instance()->suspend();
- enqueue_raw(&col);
- Queue::instance()->resume();
- QCoreApplication::processEvents();
- QTest::qWait(100);
- //FIXME verify: dfaure needed this here: QTRY_COMPARE(collectionStartedSignalSpy.count(), 0);
- QCOMPARE(collectionStartedSignalSpy.count(), 0);
- // enqueue jobC, first jobC then the collection should be executed
- Queue::instance()->enqueue(jobC);
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QVERIFY(col.isFinished());
- QVERIFY(result.startsWith(jobC->character()));
- //QSKIP("This test is too fragile"); // PENDING(Mirko): fix
- //QTRY_COMPARE(collectionStartedSignalSpy.count(), 1);
- loop.exec();
- qApp->processEvents();
- QCOMPARE(collectionStartedSignalSpy.count(), 1);
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::QueueAndDequeueCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Collection> collection(new Collection());
- collection->addJob(jobA);
- collection->addJob(jobB);
- collection->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
-
- Queue::instance()->enqueue(collection);
- Queue::instance()->dequeue(collection);
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::QueueAndDequeueSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Sequence> jobSequence(new Sequence());
- jobSequence->addJob(jobA);
- jobSequence->addJob(jobB);
- jobSequence->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
-
- Queue::instance()->enqueue(jobSequence);
- Queue::instance()->dequeue(jobSequence);
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::BlockingExecuteTest()
-{
- QString sequence;
- AppendCharacterJob job(QChar('a'), &sequence);
- job.blockingExecute();
- QCOMPARE(sequence, QString("a"));
-}
-
-void JobTests::RecursiveSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Sequence> jobSequence1(new Sequence());
- jobSequence1->addJob(jobA);
- jobSequence1->addJob(jobB);
- jobSequence1->addJob(jobC);
- QSharedPointer<Sequence> jobSequence2(new Sequence());
- jobSequence2->addJob(jobD);
- jobSequence2->addJob(jobE);
- jobSequence2->addJob(jobF);
- QSharedPointer<Sequence> jobSequence3(new Sequence());
- jobSequence3->addJob(jobG);
- jobSequence3->addJob(jobH);
- jobSequence3->addJob(jobI);
- jobSequence3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Sequence> jobSequence4(new Sequence());
- jobSequence4->addJob(jobSequence1);
- jobSequence4->addJob(jobSequence2);
- jobSequence4->addJob(jobSequence3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(jobSequence4);
-// DependencyPolicy::instance().dumpJobDependencies();
- Queue::instance()->resume();
- Queue::instance()->finish();
- QCOMPARE(sequence, QLatin1String("abcdefghij"));
-}
-
-void JobTests::RecursiveQueueAndDequeueCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Collection> collection1(new Collection());
- collection1->addJob(jobA);
- collection1->addJob(jobB);
- collection1->addJob(jobC);
- QSharedPointer<Collection> collection2(new Collection());
- collection2->addJob(jobD);
- collection2->addJob(jobE);
- collection2->addJob(jobF);
- QSharedPointer<Collection> collection3(new Collection());
- collection3->addJob(jobG);
- collection3->addJob(jobH);
- collection3->addJob(jobI);
- collection3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Collection> collection4(new Collection());
- collection4->addJob(collection1);
- collection4->addJob(collection2);
- collection4->addJob(collection3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(collection4);
- Queue::instance()->dequeue(collection4);
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
-}
-
-void JobTests::RecursiveQueueAndDequeueSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Sequence> jobSequence1(new Sequence());
- jobSequence1->addJob(jobA);
- jobSequence1->addJob(jobB);
- jobSequence1->addJob(jobC);
- QSharedPointer<Sequence> jobSequence2(new Sequence());
- jobSequence2->addJob(jobD);
- jobSequence2->addJob(jobE);
- jobSequence2->addJob(jobF);
- QSharedPointer<Sequence> jobSequence3(new Sequence());
- jobSequence3->addJob(jobG);
- jobSequence3->addJob(jobH);
- jobSequence3->addJob(jobI);
- jobSequence3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Sequence> jobSequence4(new Sequence());
- jobSequence4->addJob(jobSequence1);
- jobSequence4->addJob(jobSequence2);
- jobSequence4->addJob(jobSequence3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(jobSequence4);
- Queue::instance()->dequeue(jobSequence4);
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
-}
-
-void JobTests::QueueAndDequeueAllCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Collection> collection(new Collection());
- collection->addJob(jobA);
- collection->addJob(jobB);
- collection->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->enqueue(collection);
- //collection cannot have been started, so only one job is queued at the moment:
- QCOMPARE(Queue::instance()->queueLength(), 1);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::QueueAndDequeueAllSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<Sequence> jobSequence(new Sequence());
- jobSequence->addJob(jobA);
- jobSequence->addJob(jobB);
- jobSequence->addJob(jobC);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
-
- Queue::instance()->enqueue(jobSequence);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
-}
-
-void JobTests::RecursiveQueueAndDequeueAllCollectionTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Collection> collection1(new Collection());
- collection1->addJob(jobA);
- collection1->addJob(jobB);
- collection1->addJob(jobC);
- QSharedPointer<Collection> collection2(new Collection());
- collection2->addJob(jobD);
- collection2->addJob(jobE);
- collection2->addJob(jobF);
- QSharedPointer<Collection> collection3(new Collection());
- collection3->addJob(jobG);
- collection3->addJob(jobH);
- collection3->addJob(jobI);
- collection3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Collection> collection4(new Collection());
- collection4->addJob(collection1);
- collection4->addJob(collection2);
- collection4->addJob(collection3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(collection4);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
- Queue::instance()->finish();
-
-}
-
-void JobTests::RecursiveQueueAndDequeueAllSequenceTest()
-{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- JobPointer jobD(new AppendCharacterJob(QChar('d'), &sequence));
- JobPointer jobE(new AppendCharacterJob(QChar('e'), &sequence));
- JobPointer jobF(new AppendCharacterJob(QChar('f'), &sequence));
- JobPointer jobG(new AppendCharacterJob(QChar('g'), &sequence));
- JobPointer jobH(new AppendCharacterJob(QChar('h'), &sequence));
- JobPointer jobI(new AppendCharacterJob(QChar('i'), &sequence));
- JobPointer jobJ(new AppendCharacterJob(QChar('j'), &sequence));
- QSharedPointer<Sequence> jobSequence1(new Sequence());
- jobSequence1->addJob(jobA);
- jobSequence1->addJob(jobB);
- jobSequence1->addJob(jobC);
- QSharedPointer<Sequence> jobSequence2(new Sequence());
- jobSequence2->addJob(jobD);
- jobSequence2->addJob(jobE);
- jobSequence2->addJob(jobF);
- QSharedPointer<Sequence> jobSequence3(new Sequence());
- jobSequence3->addJob(jobG);
- jobSequence3->addJob(jobH);
- jobSequence3->addJob(jobI);
- jobSequence3->addJob(jobJ);
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- QSharedPointer<Sequence> jobSequence4(new Sequence());
- jobSequence4->addJob(jobSequence1);
- jobSequence4->addJob(jobSequence2);
- jobSequence4->addJob(jobSequence3);
-
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->suspend();
- Queue::instance()->enqueue(jobSequence4);
- Queue::instance()->dequeue();
- QVERIFY(Queue::instance()->isEmpty());
- Queue::instance()->resume();
- Queue::instance()->finish();
-}
-
-// This test is not the most efficient, as the mutex locking takes most of
-// the execution time. Anyway, it will fail if the jobs are not executed
-// in the right order, and the order is randomized.
-void JobTests::MassiveJobSequenceTest()
-{
- const int NoOfChars = 1024;
- const char *Alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- const int SizeOfAlphabet = strlen(Alphabet);
- AppendCharacterAndVerifyJob jobs[NoOfChars];
- Sequence jobSequence;
- QString sequence;
- QString in;
-
- srand(1);
- in.reserve(NoOfChars);
- sequence.reserve(NoOfChars);
- for (int i = 0; i < NoOfChars; ++i) {
- const int position = static_cast<int>(SizeOfAlphabet * ((1.0 * rand()) / RAND_MAX));
- Q_ASSERT(0 <= position && position < SizeOfAlphabet);
- QChar c(Alphabet[position]);
- in.append(c);
- }
-
- for (int i = 0; i < NoOfChars; ++i) {
- jobs[i].setValues(in.at(i), &sequence, in);
- jobSequence << jobs[i];
- }
-
- WaitForIdleAndFinished w(Queue::instance());
- QVERIFY(Queue::instance()->isIdle());
- enqueue_raw(&jobSequence);
- Queue::instance()->finish();
- QVERIFY(Queue::instance()->isIdle());
- QCOMPARE(sequence, in);
-}
-
-void JobTests::SimpleRecursiveSequencesTest()
-{
- QString sequence;
- AppendCharacterJob jobB(QChar('b'), &sequence);
- Sequence jobSequence1;
- jobSequence1 << jobB;
-
- AppendCharacterJob jobC(QChar('c'), &sequence);
- AppendCharacterJob jobA(QChar('a'), &sequence);
- Sequence jobSequence2;
- jobSequence2 << jobA;
- jobSequence2 << jobSequence1;
- jobSequence2 << jobC;
-
- WaitForIdleAndFinished w(Queue::instance());
- enqueue_raw(&jobSequence2);
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("abc"));
-}
-
-void JobTests::SequenceOfSequencesTest()
-{
- QString sequence;
- AppendCharacterJob jobA(QChar('a'), &sequence);
- AppendCharacterJob jobB(QChar('b'), &sequence);
- AppendCharacterJob jobC(QChar('c'), &sequence);
- AppendCharacterJob jobD(QChar('d'), &sequence);
- AppendCharacterJob jobE(QChar('e'), &sequence);
- AppendCharacterJob jobF(QChar('f'), &sequence);
- AppendCharacterJob jobG(QChar('g'), &sequence);
- AppendCharacterJob jobH(QChar('h'), &sequence);
- AppendCharacterJob jobI(QChar('i'), &sequence);
- AppendCharacterJob jobJ(QChar('j'), &sequence);
- Sequence jobSequence1;
- jobSequence1 << jobA << jobB << jobC;
- Sequence jobSequence2;
- jobSequence2 << jobD << jobE << jobF;
- Sequence jobSequence3;
- jobSequence3 << jobG << jobH << jobI << jobJ;
- // sequence 4 will contain sequences 1, 2, and 3, in that order:
- Sequence jobSequence4;
- jobSequence4 << jobSequence1 << jobSequence2 << jobSequence3;
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << jobSequence4;
- // Job::DumpJobDependencies();
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("abcdefghij"));
-}
-
-void JobTests::QueueAndStopTest()
-{
- QString sequence;
- AppendCharacterJob a('a', &sequence);
- AppendCharacterJob b('b', &sequence);
- AppendCharacterJob c('c', &sequence);
- FailingAppendCharacterJob d('d', &sequence);
- AppendCharacterJob e('e', &sequence);
- AppendCharacterJob f('f', &sequence);
- AppendCharacterJob g('g', &sequence);
- Sequence jobSequence;
- jobSequence << a << b << c << d << e << f << g;
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << jobSequence;
- Queue::instance()->finish();
- QCOMPARE(sequence, QString("abcd"));
-}
-
-void JobTests::ResourceRestrictionPolicyBasicsTest()
-{
- // this test tests that with resource restrictions assigned, jobs
- // still get executed as expected
- QString sequence;
- ResourceRestrictionPolicy restriction(2);
- AppendCharacterJob a('a', &sequence);
- AppendCharacterJob b('b', &sequence);
- AppendCharacterJob c('c', &sequence);
- AppendCharacterJob d('d', &sequence);
- AppendCharacterJob e('e', &sequence);
- AppendCharacterJob f('f', &sequence);
- AppendCharacterJob g('g', &sequence);
- Collection collection;
- collection << a << b << c << d << e << f << g;
- a.assignQueuePolicy(&restriction);
- b.assignQueuePolicy(&restriction);
- c.assignQueuePolicy(&restriction);
- d.assignQueuePolicy(&restriction);
- e.assignQueuePolicy(&restriction);
- f.assignQueuePolicy(&restriction);
- g.assignQueuePolicy(&restriction);
-
- WaitForIdleAndFinished w(Queue::instance());
- stream() << collection;
- Queue::instance()->finish();
- QVERIFY(Queue::instance()->isIdle());
-}
-
-void JobTests::jobStarted(JobPointer)
-{
- // qDebug() << "jobStarted";
- QVERIFY(thread() == QThread::currentThread());
-}
-
-void JobTests::jobDone(JobPointer)
-{
- // qDebug() << "jobDone";
- QVERIFY(thread() == QThread::currentThread());
-}
-
-void JobTests::JobSignalsAreEmittedAsynchronouslyTest()
-{
- using namespace ThreadWeaver;
-
- char bits[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g' };
- const int NumberOfBits = sizeof bits / sizeof bits[0];
- QString sequence;
- QObjectDecorator collection(new Collection, this);
-
- QVERIFY(connect(&collection, SIGNAL(started(ThreadWeaver::JobPointer)), SLOT(jobStarted(ThreadWeaver::JobPointer))));
- QVERIFY(connect(&collection, SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(jobDone(ThreadWeaver::JobPointer))));
- for (int counter = 0; counter < NumberOfBits; ++counter) {
- QJobPointer job(new QObjectDecorator(new AppendCharacterJob(bits[counter], &sequence)));
- QVERIFY(connect(job.data(), SIGNAL(started(ThreadWeaver::JobPointer)), SLOT(jobStarted(ThreadWeaver::JobPointer))));
- QVERIFY(connect(job.data(), SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(jobDone(ThreadWeaver::JobPointer))));
- collection.collection()->addJob(job);
- }
-
- WaitForIdleAndFinished w(Queue::instance());
- enqueue_raw(&collection);
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QVERIFY(sequence.length() == NumberOfBits);
-}
-
-QAtomicInt deliveryTestCounter;
-
-void JobTests::deliveryTestJobDone(JobPointer)
-{
- deliveryTestCounter.fetchAndAddRelease(-1);
-}
-
-void noOp() {}
-
-void JobTests::JobSignalsDeliveryTest()
-{
- //This test was added to investigate segmentation faults during signal delivery from jobs to the main thread.
- //Relies on processEvents() processing all pending events, as the specification says.
- using namespace ThreadWeaver;
-
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
- WaitForIdleAndFinished w(Queue::instance());
- for (int count = 0; count < 100; ++count) {
- QJobPointer job(new QObjectDecorator(new Lambda<void(*)()>(noOp)));
- QVERIFY(connect(job.data(), SIGNAL(done(ThreadWeaver::JobPointer)), SLOT(deliveryTestJobDone(ThreadWeaver::JobPointer))));
- deliveryTestCounter.fetchAndAddRelease(1);
- Queue::instance()->enqueue(job);
- }
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QCoreApplication::processEvents();
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
-}
-
-void decrementCounter()
-{
- deliveryTestCounter.fetchAndAddRelease(-1);
-}
-
-void JobTests::JobPointerExecutionTest()
-{
- //This test was added to investigate segmentation faults during signal delivery from jobs to the main thread.
- //Relies on processEvents() processing all pending events, as the specification says.
- using namespace ThreadWeaver;
-
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
- WaitForIdleAndFinished w(Queue::instance());
- for (int count = 0; count < 100; ++count) {
- JobPointer job(new Lambda<void(*)()>(decrementCounter));
- deliveryTestCounter.fetchAndAddRelease(1);
- Queue::instance()->enqueue(job);
- }
- QCoreApplication::processEvents();
- Queue::instance()->finish();
- QCoreApplication::processEvents();
- QCOMPARE(deliveryTestCounter.loadAcquire(), 0);
-}
-
-void JobTests::DequeueSuspendedSequenceTest()
-{
- using namespace ThreadWeaver;
-
- Sequence sequence;
- Queue weaver;
- weaver.suspend();
- enqueue_raw(&weaver, &sequence);
- weaver.dequeue();
- // don't crash
-}
-
-void JobTests::IdDecoratorDecoratesTest()
-{
- using namespace ThreadWeaver;
- QString sequence;
- JobPointer job(new IdDecorator(new AppendCharacterJob('a', &sequence)));
- WaitForIdleAndFinished w(Queue::instance());
- Queue::instance()->enqueue(job);
- Queue::instance()->finish();
- QCOMPARE(sequence, QString::fromLatin1("a"));
-}
-
-void JobTests::IdDecoratorAutoDeleteTest()
-{
- using namespace ThreadWeaver;
- IdDecorator id(0);
- QCOMPARE(id.autoDelete(), true); // autoDelete is on by default
- id.setAutoDelete(false);
- QCOMPARE(id.autoDelete(), false);
- id.setAutoDelete(true);
- QCOMPARE(id.autoDelete(), true);
- // now do not crash, even though id decorates a null pointer
-}
-
-void JobTests::IdDecoratorSingleAllocationTest()
-{
- using namespace ThreadWeaver;
-
- struct DecoratedJob : public IdDecorator {
- QString sequence;
- AppendCharacterJob job;
- DecoratedJob() : IdDecorator(&job, false), job('a', &sequence) {}
- };
-
- WaitForIdleAndFinished w(Queue::instance());
- DecoratedJob job;
- enqueue_raw(&job);
- Queue::instance()->finish();
- QCOMPARE(job.sequence, QString::fromLatin1("a"));
-}
-
-struct InstanceCountedJob : public Job {
- static QAtomicInt counter;
-
- void run(JobPointer, Thread *)
- {
- }
-
- InstanceCountedJob()
- {
- counter.fetchAndAddRelease(1);
- }
-
- ~InstanceCountedJob()
- {
- counter.fetchAndAddRelease(-1);
- }
-};
-
-QAtomicInt InstanceCountedJob::counter;
-
-/** @brief Verify that neither the queue nor the thread keep a reference to the job after completing it.
- *
- * This is necessary because user-allocated objects like queue policies may be registered with the jobs. If the jobs stick around
- * until the thread or queue are deleted, the user-allocatd objects may have gone out of scope or been deleted already, causing
- * potential errors. From ThreadWeaver's point of view, a job seizes to exist once the processing thread asks for the next job. */
-void JobTests::JobsAreDestroyedAfterFinishTest()
-{
- using namespace ThreadWeaver;
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- Queue::instance()->suspend();
- JobPointer job(new InstanceCountedJob);
- Queue::instance()->enqueue(job);
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- Queue::instance()->resume();
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- Queue::instance()->finish();
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- QCoreApplication::processEvents();
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 1);
- job.clear();
- // if this succeeds, job is the only shared pointer pointing to the created InstanceCountedJob object:
- QCOMPARE(InstanceCountedJob::counter.loadAcquire(), 0);
-}
-
-void JobTests::JobExitStatusByExceptionTest()
-{
- using namespace ThreadWeaver;
-
- struct FailingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- throw JobFailed();
- }
- };
-
- FailingJob failing;
- failing.blockingExecute();
- QCOMPARE(failing.status(), Job::Status_Failed);
-
- struct AbortingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- throw JobAborted();
- }
- };
-
- AbortingJob aborting;
- aborting.blockingExecute();
- QCOMPARE(aborting.status(), Job::Status_Aborted);
-
- struct SuccessfulJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- // do nothing
- }
- };
- SuccessfulJob successful;
- successful.blockingExecute();
- QCOMPARE(successful.status(), Job::Status_Success);
-}
-
-void JobTests::JobManualExitStatusTest()
-{
- using namespace ThreadWeaver;
-
- struct FailingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- setStatus(Job::Status_Failed);
- }
- };
-
- FailingJob failing;
- failing.blockingExecute();
- QCOMPARE(failing.status(), Job::Status_Failed);
-
- struct AbortingJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- setStatus(Job::Status_Aborted);
- }
- };
-
- AbortingJob aborting;
- aborting.blockingExecute();
- QCOMPARE(aborting.status(), Job::Status_Aborted);
-
- struct SuccessfulJob : public Job {
- void run(JobPointer, Thread *) Q_DECL_OVERRIDE {
- // do nothing
- }
- };
- SuccessfulJob successful;
- successful.blockingExecute();
- QCOMPARE(successful.status(), Job::Status_Success);
-}
-
-void JobTests::QueueStreamLifecycletest()
-{
- QString sequence;
- using namespace ThreadWeaver;
- WaitForIdleAndFinished w(Queue::instance()); Q_UNUSED(w);
- stream() << make_job(new AppendCharacterJob('a', &sequence)) // enqueues JobPointer
- << new AppendCharacterJob('b', &sequence) // enqueues JobInterface*
- << make_job(new AppendCharacterJob('c', &sequence));
- Queue::instance()->finish();
- QCOMPARE(sequence.count(), 3);
-}
-
-QTEST_MAIN(JobTests)
-
diff --git a/src/3rdparty/threadweaver/autotests/JobTests.h b/src/3rdparty/threadweaver/autotests/JobTests.h
deleted file mode 100644
index 71fc839d9..000000000
--- a/src/3rdparty/threadweaver/autotests/JobTests.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for job processing in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef JOBTESTS_H
-#define JOBTESTS_H
-
-#include <QtCore/QObject>
-#include <ThreadWeaver/JobPointer>
-
-namespace ThreadWeaver
-{
-class Job;
-}
-
-using ThreadWeaver::Job;
-
-class JobTests : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void initTestCase();
- void WeaverLazyThreadCreationTest();
- void SimpleJobTest();
- void SimpleJobCollectionTest();
- void EmptyJobCollectionTest();
- void CollectionQueueingTest();
- void GeneratingCollectionTest();
- void ShortJobSequenceTest();
- void EmptyJobSequenceTest();
- void GeneratingSequenceTest();
- void IncompleteCollectionTest();
- void EmitStartedOnFirstElementTest();
- void CollectionDependenciesTest();
- void QueueAndDequeueCollectionTest();
- void QueueAndDequeueSequenceTest();
- void BlockingExecuteTest();
- void RecursiveSequenceTest();
- void RecursiveQueueAndDequeueCollectionTest();
- void RecursiveQueueAndDequeueSequenceTest();
- void QueueAndDequeueAllCollectionTest();
- void QueueAndDequeueAllSequenceTest();
- void RecursiveQueueAndDequeueAllCollectionTest();
- void RecursiveQueueAndDequeueAllSequenceTest();
- void MassiveJobSequenceTest();
- void SimpleRecursiveSequencesTest();
- void SequenceOfSequencesTest();
- void QueueAndStopTest();
- void ResourceRestrictionPolicyBasicsTest();
- void JobSignalsAreEmittedAsynchronouslyTest();
- void JobSignalsDeliveryTest();
- void JobPointerExecutionTest();
- void DequeueSuspendedSequenceTest();
- void IdDecoratorDecoratesTest();
- void IdDecoratorAutoDeleteTest();
- void IdDecoratorSingleAllocationTest();
- void JobsAreDestroyedAfterFinishTest();
- void JobExitStatusByExceptionTest();
- void JobManualExitStatusTest();
- void QueueStreamLifecycletest();
-
-public Q_SLOTS: // slots used during tests that are not test cases
- void jobStarted(ThreadWeaver::JobPointer);
- void jobDone(ThreadWeaver::JobPointer);
-
- void deliveryTestJobDone(ThreadWeaver::JobPointer);
-};
-
-#endif
diff --git a/src/3rdparty/threadweaver/autotests/LifecycleTests.cpp b/src/3rdparty/threadweaver/autotests/LifecycleTests.cpp
deleted file mode 100644
index aca8713b8..000000000
--- a/src/3rdparty/threadweaver/autotests/LifecycleTests.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for JobPointer behaviour in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <QString>
-#include <QtTest>
-
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/JobPointer>
-#include <ThreadWeaver/Job>
-
-class NotifyOnDeletejob : public ThreadWeaver::Job
-{
-public:
- explicit NotifyOnDeletejob(bool &exists)
- : ThreadWeaver::Job()
- , m_exists(exists)
- {
- exists = true;
- }
-
- ~NotifyOnDeletejob()
- {
- m_exists = false;
- }
-
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *) {}
-
-private:
- bool &m_exists;
-};
-
-class LifecycleTests : public QObject
-{
- Q_OBJECT
-
-public:
- LifecycleTests();
-
-private Q_SLOTS:
- void testJobAutoDeletionBasics();
- void testJobAutoDeletion();
-};
-
-LifecycleTests::LifecycleTests()
-{
-}
-
-void LifecycleTests::testJobAutoDeletionBasics()
-{
- bool job1Exists = false;
- bool job2Exists = false;
- ThreadWeaver::JobPointer job2(new NotifyOnDeletejob(job2Exists));
- Q_UNUSED(job2);
- QCOMPARE(true, job2Exists);
- {
- ThreadWeaver::JobPointer job1(new NotifyOnDeletejob(job1Exists));
- Q_UNUSED(job1);
- QCOMPARE(job1Exists, true);
- }
- QCOMPARE(job1Exists, false);
- QCOMPARE(job2Exists, true);
-}
-
-void LifecycleTests::testJobAutoDeletion()
-{
- bool job1Exists = false;
- bool job2Exists = false;
- {
- ThreadWeaver::JobPointer job1(new NotifyOnDeletejob(job1Exists));
- QCOMPARE(job1Exists, true);
- int argc = 0;
- QCoreApplication app(argc, (char **)0); Q_UNUSED(app);
- QVERIFY(ThreadWeaver::Queue::instance());
- ThreadWeaver::Queue::instance()->suspend();
- ThreadWeaver::Queue::instance()->enqueue(job1);
- ThreadWeaver::Queue::instance()->enqueue(ThreadWeaver::JobPointer(new NotifyOnDeletejob(job2Exists)));
- QCOMPARE(job2Exists, true);
- ThreadWeaver::Queue::instance()->resume();
- ThreadWeaver::Queue::instance()->finish();
- QVERIFY(ThreadWeaver::Queue::instance()->isIdle());
- ThreadWeaver::Queue::instance()->suspend();
- QEXPECT_FAIL("", "TODO this *should* work!", Continue);
- QCOMPARE(job2Exists, false);
- QCOMPARE(job1Exists, true);
- }
- QVERIFY(ThreadWeaver::Queue::instance() == 0);
- QCOMPARE(job2Exists, false);
- QCOMPARE(job1Exists, false);
-}
-
-QTEST_APPLESS_MAIN(LifecycleTests)
-
-#include "LifecycleTests.moc"
diff --git a/src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp b/src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp
deleted file mode 100644
index 7528e0cf4..000000000
--- a/src/3rdparty/threadweaver/autotests/QueueFactoryTests.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for global queue customizations in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <QString>
-#include <QtTest>
-
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/QueueSignals>
-#include <ThreadWeaver/Queue>
-#include <weaver_p.h>
-#include <ThreadWeaver/IdDecorator>
-
-using namespace ThreadWeaver;
-QAtomicInt counter;
-
-class CountingJobDecorator : public IdDecorator
-{
-public:
- explicit CountingJobDecorator(const JobPointer &job)
- : IdDecorator(job.data(), false)
- , original_(job)
- {}
-
- void run(JobPointer self, Thread *thread) Q_DECL_OVERRIDE {
- counter.fetchAndAddRelease(1);
- IdDecorator::run(self, thread);
- counter.fetchAndAddAcquire(1);
- }
-
- JobPointer original_;
-};
-
-class JobCountingWeaver : public Weaver
-{
- Q_OBJECT
-public:
- explicit JobCountingWeaver(QObject *parent = 0) : Weaver(parent) {}
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE {
- QVector<JobPointer> decorated;
- std::transform(jobs.begin(), jobs.end(), std::back_inserter(decorated),
- [](const JobPointer & job)
- {
- return JobPointer(new CountingJobDecorator(job));
- });
- Weaver::enqueue(decorated);
- }
-};
-
-class CountingGlobalQueueFactory : public Queue::GlobalQueueFactory
-{
- Queue *create(QObject *parent = 0) Q_DECL_OVERRIDE {
- return new Queue(new JobCountingWeaver, parent);
- }
-};
-
-int argc = 0;
-
-class QueueFactoryTests : public QObject
-{
- Q_OBJECT
-private Q_SLOTS:
- void testQueueFactory()
- {
- counter.storeRelease(0);
- QCoreApplication app(argc, (char **)0);
- Queue queue(new JobCountingWeaver(this));
- queue.enqueue(make_job([]() {})); // nop
- queue.finish();
- QCOMPARE(counter.loadAcquire(), 2);
- }
-
- void testGlobalQueueFactory()
- {
- Queue::setGlobalQueueFactory(new CountingGlobalQueueFactory());
- QCoreApplication app(argc, (char **)0);
- counter.storeRelease(0);
- Queue::instance()->enqueue(make_job([]() {})); // nop
- Queue::instance()->finish();
- QCOMPARE(counter.loadAcquire(), 2);
- }
-};
-
-QTEST_APPLESS_MAIN(QueueFactoryTests)
-
-#include "QueueFactoryTests.moc"
diff --git a/src/3rdparty/threadweaver/autotests/QueueTests.cpp b/src/3rdparty/threadweaver/autotests/QueueTests.cpp
deleted file mode 100644
index a758d660f..000000000
--- a/src/3rdparty/threadweaver/autotests/QueueTests.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-#include "QueueTests.h"
-
-#include <QtCore/QChar>
-
-#include <QtCore/QObject>
-#include <QtCore/QThread>
-#include <QtCore/QDebug>
-#include <QtTest/QtTest>
-
-#include "AppendCharacterJob.h"
-
-#include <ThreadWeaver/Queueing>
-/* -*- C++ -*-
-
- This file contains a testsuite for the queueing behaviour in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <ThreadWeaver/Job>
-#include <ThreadWeaver/State>
-#include <ThreadWeaver/QueuePolicy>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/Collection>
-#include <ThreadWeaver/DebuggingAids>
-#include <ThreadWeaver/DependencyPolicy>
-#include <ThreadWeaver/ResourceRestrictionPolicy>
-
-#include <ThreadWeaver/ThreadWeaver>
-#include <ThreadWeaver/Thread>
-#include <ThreadWeaver/QObjectDecorator>
-
-QMutex s_GlobalMutex;
-
-LowPriorityAppendCharacterJob::LowPriorityAppendCharacterJob(QChar c, QString *stringref)
- : AppendCharacterJob(c, stringref)
-{}
-
-int LowPriorityAppendCharacterJob ::priority() const
-{
- return -1;
-}
-
-HighPriorityAppendCharacterJob::HighPriorityAppendCharacterJob(QChar c, QString *stringref)
- : AppendCharacterJob(c, stringref)
-{}
-
-int HighPriorityAppendCharacterJob::priority() const
-{
- return 1;
-}
-
-SecondThreadThatQueues::SecondThreadThatQueues()
- : QThread()
-{
-}
-
-void SecondThreadThatQueues::run()
-{
- QString sequence;
- AppendCharacterJob a('a', &sequence);
-
- ThreadWeaver::enqueue_raw(&a);
- ThreadWeaver::Queue::instance()->finish();
- QCOMPARE(sequence, QString("a"));
-}
-
-QueueTests::QueueTests(QObject *parent)
- : QObject(parent)
- , autoDeleteJob(0)
-{
-}
-
-void QueueTests::initTestCase()
-{
- ThreadWeaver::setDebugLevel(true, 1);
-}
-
-void QueueTests::SimpleQueuePrioritiesTest()
-{
- using namespace ThreadWeaver;
-
- Queue weaver;
- weaver.setMaximumNumberOfThreads(1); // just one thread
- QString sequence;
- LowPriorityAppendCharacterJob jobA(QChar('a'), &sequence);
- AppendCharacterJob jobB(QChar('b'), &sequence);
- HighPriorityAppendCharacterJob jobC(QChar('c'), &sequence);
-
- // queue low priority, then normal priority, then high priority
- // if priorities are processed correctly, the jobs will be executed in reverse order
-
- weaver.suspend();
-
- enqueue_raw(&weaver, &jobA);
- enqueue_raw(&weaver, &jobB);
- enqueue_raw(&weaver, &jobC);
-
- weaver.resume();
- weaver.finish();
-
- QCOMPARE(sequence, QString("cba"));
-}
-
-void QueueTests::WeaverInitializationTest()
-{
- // this one mostly tests the sanity of the startup behaviour
- ThreadWeaver::Queue weaver;
- QCOMPARE(weaver.currentNumberOfThreads(), 0);
- QVERIFY(weaver.isEmpty());
- QVERIFY(weaver.isIdle());
- QVERIFY(weaver.queueLength() == 0);
- weaver.finish();
-}
-
-void QueueTests::QueueFromSecondThreadTest()
-{
- ThreadWeaver::Queue::instance(); //create global instance in the main thread
- SecondThreadThatQueues thread;
- thread.start();
- thread.wait();
- QVERIFY(ThreadWeaver::Queue::instance()->isIdle());
-}
-
-void QueueTests::deleteJob(ThreadWeaver::JobPointer job)
-{
- // test that signals are properly emitted (asynchronously, that is):
- QVERIFY(thread() == QThread::currentThread());
- QVERIFY(job == autoDeleteJob);
- delete autoDeleteJob; autoDeleteJob = 0;
-}
-
-void QueueTests::DeleteDoneJobsFromSequenceTest()
-{
- using namespace ThreadWeaver;
- QString sequence;
- autoDeleteJob = new QObjectDecorator(new AppendCharacterJob(QChar('a'), &sequence));
- AppendCharacterJob b(QChar('b'), &sequence);
- AppendCharacterJob c(QChar('c'), &sequence);
- Collection collection;
- collection << make_job_raw(autoDeleteJob) << b << c;
- QVERIFY(autoDeleteJob != 0);
- QVERIFY(connect(autoDeleteJob, SIGNAL(done(ThreadWeaver::JobPointer)),
- SLOT(deleteJob(ThreadWeaver::JobPointer))));
- stream() << collection;
- QTest::qWait(100); // return to event queue to make sure signals are delivered
- Queue::instance()->finish();
- QTest::qWait(100); // return to event queue to make sure signals are delivered
- // no need to delete a, that should be done in deleteJob
- QVERIFY(autoDeleteJob == 0);
-}
-
-void QueueTests::deleteCollection(ThreadWeaver::JobPointer collection)
-{
- QVERIFY(thread() == QThread::currentThread());
- QVERIFY(collection == autoDeleteCollection);
- delete autoDeleteCollection; autoDeleteCollection = 0;
-}
-
-void QueueTests::DeleteCollectionOnDoneTest()
-{
- using namespace ThreadWeaver;
- QString sequence;
- autoDeleteCollection = new QObjectDecorator(new Collection);
- QVERIFY(connect(autoDeleteCollection, SIGNAL(done(ThreadWeaver::JobPointer)),
- SLOT(deleteCollection(ThreadWeaver::JobPointer))));
-
- AppendCharacterJob a(QChar('a'), &sequence);
- AppendCharacterJob b(QChar('b'), &sequence);
- *autoDeleteCollection->collection() << a << b;
-
- enqueue_raw(autoDeleteCollection);
- // return to event queue to make sure signals are delivered
- // (otherwise, no slot calls would happen before the end of this function)
- // I assume the amount of time that we wait does not matter
- QTest::qWait(10);
- Queue::instance()->finish();
- // return to event queue to make sure signals are delivered
- QTest::qWait(10);
- // no need to delete a, that should be done in deleteJob
- QVERIFY(sequence.length() == 2);
- QVERIFY(autoDeleteCollection == 0);
-}
-
-QTEST_MAIN(QueueTests)
-
diff --git a/src/3rdparty/threadweaver/autotests/QueueTests.h b/src/3rdparty/threadweaver/autotests/QueueTests.h
deleted file mode 100644
index f66c07afc..000000000
--- a/src/3rdparty/threadweaver/autotests/QueueTests.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for the queueing behaviour in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef QUEUETESTS_H
-#define QUEUETESTS_H
-
-#include <QtCore/QThread>
-
-#include "AppendCharacterJob.h"
-
-class LowPriorityAppendCharacterJob : public AppendCharacterJob
-{
-public:
- LowPriorityAppendCharacterJob(QChar character = QChar(), QString *stringref = 0);
-
- int priority() const;
-};
-
-class HighPriorityAppendCharacterJob : public AppendCharacterJob
-{
-public:
- HighPriorityAppendCharacterJob(QChar character = QChar(), QString *stringref = 0);
-
- int priority() const;
-};
-
-namespace ThreadWeaver
-{
-class Job;
-class Collection;
-class QObjectDecorator;
-}
-
-using ThreadWeaver::Job;
-
-class SecondThreadThatQueues : public QThread
-{
- Q_OBJECT
-
-public:
- SecondThreadThatQueues();
-
-protected:
- void run();
-};
-
-class QueueTests : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QueueTests(QObject *parent = 0);
-
-public Q_SLOTS:
- // this slot (which is not a test) is part of
- // DeleteDoneJobsFromSequenceTest
- void deleteJob(ThreadWeaver::JobPointer);
- // this slot is part of DeleteCollectionOnDoneTest
- void deleteCollection(ThreadWeaver::JobPointer);
-
-private:
- // this is also part of DeleteDoneJobsFromSequenceTest
- ThreadWeaver::QObjectDecorator *autoDeleteJob;
- // this is part of DeleteCollectionOnDoneTest
- ThreadWeaver::QObjectDecorator *autoDeleteCollection;
-
-private Q_SLOTS:
-
- void initTestCase();
-
- void SimpleQueuePrioritiesTest();
- void WeaverInitializationTest();
- void QueueFromSecondThreadTest();
- void DeleteDoneJobsFromSequenceTest();
- void DeleteCollectionOnDoneTest();
-};
-
-#endif
diff --git a/src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp b/src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp
deleted file mode 100644
index 832626f0a..000000000
--- a/src/3rdparty/threadweaver/autotests/ShutdownOnQApplicationQuitTests.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a testsuite for global queue instantiation in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <QString>
-#include <QtTest>
-
-#include <ThreadWeaver/ThreadWeaver>
-
-// The tests checks if the global ThreadWeaver instance is properly
-// destroyed along with QCoreApplication. After that all the puppies
-// are sad and the kittens cry, and the test exits.
-class ShutdownOnQApplicationQuitTests : public QObject
-{
- Q_OBJECT
-
-public:
- ShutdownOnQApplicationQuitTests();
-
-private Q_SLOTS:
- void testShutdownOnQApplicationQuit();
-};
-
-ShutdownOnQApplicationQuitTests::ShutdownOnQApplicationQuitTests()
-{
-}
-
-void ShutdownOnQApplicationQuitTests::testShutdownOnQApplicationQuit()
-{
- {
- int argc = 0;
- QCoreApplication app(argc, (char **)0);
- QVERIFY(ThreadWeaver::Queue::instance() != 0);
- ThreadWeaver::Queue::instance()->suspend();
- ThreadWeaver::Queue::instance()->resume();
- QTest::qWait(10);
- }
- QVERIFY(ThreadWeaver::Queue::instance() == 0);
-}
-
-QTEST_APPLESS_MAIN(ShutdownOnQApplicationQuitTests)
-
-#include "ShutdownOnQApplicationQuitTests.moc"
diff --git a/src/3rdparty/threadweaver/autotests/run-n-tests.py b/src/3rdparty/threadweaver/autotests/run-n-tests.py
deleted file mode 100644
index 55fe98fe9..000000000
--- a/src/3rdparty/threadweaver/autotests/run-n-tests.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-#
-# Helper script to run unit tests repeatedly.
-#
-# Author: Mirko Boehm
-# Copyright: (C) 2005-2013 Mirko Boehm
-# Contact: mirko@kde.org
-# http://www.kde.org
-# http://creative-destruction.me $
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-import re
-import os
-import sys
-import time
-import platform
-
-def RunTests( Number ):
- # use Linux as the default:
- SuccessCount = 0
- Platform = platform.platform()
-# Command = "./ThreadWeaverJobTests EmitStartedOnFirstElementTest"
-# Command = "./ThreadWeaverJobTests CollectionDependenciesTest"
-# Command = "./ThreadWeaverJobTests JobSignalsDeliveryTest"
-# Command = "./ThreadWeaverJobTests"
- Command = "make test"
-# if re.search( "Darwin", Platform ):
-# Command = "DYLD_LIBRARY_PATH=../Weaver:../Experimental ./JobTests.app/Contents/MacOs/JobTests >/dev/null"
- for count in range( Number ):
- retValue = os.system ( Command)
- resultString = " (FAILED)"
- if retValue == 0:
- resultString = " (succeeded)"
- SuccessCount = SuccessCount + 1
- else:
- sys.exit(1)
- print "Test run #" + str(count + 1) + resultString
- return SuccessCount
-
-Number = 10
-
-try:
- Number = int ( sys.argv[1] )
-except:
- print "No number given, using default of ", Number
-
-FailedCount = 0
-SuccessCount = 0
-
-t1 = time.time()
-SuccessCount = RunTests ( Number )
-t2 = time.time()
-
-
-elapsed = ((t2 - t1) / 60.0, t2 - t1, (t2 - t1) * 1000.0)
-
-print "RunTests: " + str(Number) + " test runs (" + str(SuccessCount) + " successful, " + str(Number - SuccessCount) + " failed)"
-print "RunTests: %0.3fms (%0.3fs)" % ( elapsed[2], elapsed[1] )
-print "Averages: %0.3fms per test run (%0.3fs)" % ( elapsed[2] / Number, elapsed[1] / Number )
-
-
-
diff --git a/src/3rdparty/threadweaver/benchmarks/CMakeLists.txt b/src/3rdparty/threadweaver/benchmarks/CMakeLists.txt
deleted file mode 100644
index 374ce5a4e..000000000
--- a/src/3rdparty/threadweaver/benchmarks/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-find_package(Qt5Test 5.2.0 REQUIRED NO_MODULE)
-
-if(NOT MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-endif()
-
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/../src/ThreadWeaver/
-)
-
-remove_definitions(-DQT_NO_CAST_FROM_ASCII)
-
-########### next target ###############
-
-set(QueueBenchmarks_SRCS QueueBenchmarks.cpp)
-
-add_executable(ThreadWeaverQueueBenchmarks ${QueueBenchmarks_SRCS})
-# add_test(ThreadWeaverQueueBenchmarks ThreadWeaverQueueBenchmarks)
-
-target_link_libraries(ThreadWeaverQueueBenchmarks Qt5::Test KF5::ThreadWeaver)
diff --git a/src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp b/src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp
deleted file mode 100644
index 70fb3407a..000000000
--- a/src/3rdparty/threadweaver/benchmarks/QueueBenchmarks.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- C++ -*-
-
- This file contains a benchmark for job processing in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <numeric>
-
-#include <QtDebug>
-#include <QString>
-#include <QtTest>
-#include <QCoreApplication>
-#include <QList>
-
-#include <ThreadWeaver/Queueing>
-#include <ThreadWeaver/Job>
-#include <ThreadWeaver/Collection>
-#include <ThreadWeaver/Sequence>
-#include <ThreadWeaver/ThreadWeaver>
-
-class AccumulateJob : public ThreadWeaver::Job
-{
-public:
- explicit AccumulateJob()
- : m_count(0)
- , m_result(0)
- {
- }
- AccumulateJob(const AccumulateJob &a)
- : ThreadWeaver::Job()
- , m_count(a.m_count)
- , m_result(a.m_result)
- {
- }
-
- void setCount(quint64 count)
- {
- m_count = count;
- }
-
- quint64 result() const
- {
- return m_result;
- }
-
- void executeRun()
- {
- run(ThreadWeaver::JobPointer(), 0);
- }
-
-protected:
- void run(ThreadWeaver::JobPointer, ThreadWeaver::Thread *)
- {
- std::vector<quint64> numbers(m_count);
- std::generate(numbers.begin(), numbers.end(), []() -> quint64 { static quint64 i = 0; return i++; });
- m_result = std::accumulate(numbers.begin(), numbers.end(), 0);
- }
-
-private:
- quint64 m_count;
- quint64 m_result;
-};
-
-class QueueBenchmarksTest : public QObject
-{
- Q_OBJECT
-
-public:
- QueueBenchmarksTest();
-
-private Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
- void BaselineBenchmark();
- void BaselineBenchmark_data();
- void BaselineAsJobsBenchmark();
- void BaselineAsJobsBenchmark_data();
- void IndividualJobsBenchmark();
- void IndividualJobsBenchmark_data();
- void CollectionsBenchmark();
- void CollectionsBenchmark_data();
- void SequencesBenchmark();
- void SequencesBenchmark_data();
-
-private:
- void defaultBenchmarkData(bool singleThreaded);
-};
-
-QueueBenchmarksTest::QueueBenchmarksTest()
-{
-}
-
-void QueueBenchmarksTest::initTestCase()
-{
-}
-
-void QueueBenchmarksTest::cleanupTestCase()
-{
-}
-
-/** @brief BaselineBenchmark simply performs the same operations in a loop.
- *
- * The result amounts to what time the jobs used in the benchmark need to execute without queueing or thread
- * synchronization overhead. */
-void QueueBenchmarksTest::BaselineBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
- Q_UNUSED(t); // in this case
-
- QVector<AccumulateJob> jobs(n);
- for (int i = 0; i < n; ++i) {
- jobs[i].setCount(m);
- }
-
- //executeLocal needs to emit similar signals as execute(), to be comparable to the threaded variants.
- //BaselineAsJobsBenchmark does that. Compare BaselineAsJobsBenchmark and BaselineBenchmark to evaluate the overhead of executing
- //an operation in a job.
- QBENCHMARK {
- for (int i = 0; i < n; ++i)
- {
- jobs[i].executeRun();
- }
- }
-}
-
-void QueueBenchmarksTest::BaselineBenchmark_data()
-{
- defaultBenchmarkData(true);
-}
-
-void QueueBenchmarksTest::BaselineAsJobsBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
- Q_UNUSED(t); // in this case
-
- QVector<AccumulateJob> jobs(n);
- for (int i = 0; i < n; ++i) {
- jobs[i].setCount(m);
- }
-
- QBENCHMARK {
- for (int i = 0; i < n; ++i)
- {
- jobs[i].blockingExecute();
- }
- }
-}
-
-void QueueBenchmarksTest::BaselineAsJobsBenchmark_data()
-{
- defaultBenchmarkData(true);
-}
-
-void QueueBenchmarksTest::IndividualJobsBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
-
- ThreadWeaver::Queue weaver;
- weaver.setMaximumNumberOfThreads(t);
- weaver.suspend();
- QVector<AccumulateJob> jobs(n);
- for (int i = 0; i < n; ++i) {
- jobs[i].setCount(m);
- ThreadWeaver::enqueue_raw(&weaver, &jobs[i]);
- }
-
- QBENCHMARK_ONCE {
- weaver.resume();
- weaver.finish();
- }
-}
-
-void QueueBenchmarksTest::IndividualJobsBenchmark_data()
-{
- defaultBenchmarkData(false);
-}
-
-void QueueBenchmarksTest::CollectionsBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
-
- ThreadWeaver::Queue weaver;
- weaver.setMaximumNumberOfThreads(t);
- weaver.suspend();
- QVector<AccumulateJob> jobs(n);
-
- //FIXME currently, memory management of the job sequences (they are deleted when they go out of scope)
- //is measured as part of the benchmark
- qDebug() << b << "blocks" << c << "operations, queueing...";
- //queue the jobs blockwise as collections
- for (int block = 0; block < b; ++block) {
- ThreadWeaver::Collection *collection = new ThreadWeaver::Collection();
- for (int operation = 0; operation < c; ++operation) {
- const int index = block * b + operation;
- jobs[index].setCount(m);
- *collection << jobs[index];
- }
- weaver.stream() << collection;
- }
-
- qDebug() << b << "blocks" << c << "operations, executing...";
- QBENCHMARK_ONCE {
- weaver.resume();
- weaver.finish();
- }
-}
-
-void QueueBenchmarksTest::CollectionsBenchmark_data()
-{
- defaultBenchmarkData(false);
-}
-
-void QueueBenchmarksTest::SequencesBenchmark()
-{
- QFETCH(int, m);
- QFETCH(int, c);
- QFETCH(int, b);
- QFETCH(int, t);
- const int n = c * b;
-
- ThreadWeaver::Queue weaver;
- weaver.setMaximumNumberOfThreads(t);
- weaver.suspend();
- QVector<AccumulateJob> jobs(n);
-
- qDebug() << b << "blocks" << c << "operations, queueing...";
- //queue the jobs blockwise as collections
- for (int block = 0; block < b; ++block) {
- ThreadWeaver::Sequence *sequence = new ThreadWeaver::Sequence();
- for (int operation = 0; operation < c; ++operation) {
- const int index = block * b + operation;
- jobs[index].setCount(m);
- *sequence << jobs[index];
- }
- weaver.stream() << sequence;
- }
-
- qDebug() << b << "blocks" << c << "operations, executing...";
- QBENCHMARK_ONCE {
- weaver.resume();
- weaver.finish();
- }
-}
-
-void QueueBenchmarksTest::SequencesBenchmark_data()
-{
- defaultBenchmarkData(false);
-}
-
-void QueueBenchmarksTest::defaultBenchmarkData(bool singleThreaded)
-{
- QTest::addColumn<int>("m"); // number of quint64's to accumulate
- QTest::addColumn<int>("c"); // operations per block
- QTest::addColumn<int>("b"); // number of blocks, number of jobs is b*c
- QTest::addColumn<int>("t"); // number of worker threads
-
- const QList<int> threads = singleThreaded ? QList<int>() << 1 : QList<int>() << 1 << 2 << 4 << 8 << 16 << 32 << 64 << 128;
- const QList<int> ms = QList<int>() << 1 << 10 << 100 << 1000 << 10000 << 100000;
- Q_FOREACH (int m, ms) {
- Q_FOREACH (int t, threads) {
- const QString name = QString::fromLatin1("%1 threads, %2 values").arg(t).arg(m);
- // newRow expects const char*, but then qstrdup's it in the QTestData constructor. Eeeew.
- QTest::newRow(qPrintable(name)) << m << 256 << 256 << t;
- }
- }
-}
-
-QTEST_MAIN(QueueBenchmarksTest)
-
-#include "QueueBenchmarks.moc"
diff --git a/src/3rdparty/threadweaver/doxygen-footer.html b/src/3rdparty/threadweaver/doxygen-footer.html
deleted file mode 100644
index 7a2ff0940..000000000
--- a/src/3rdparty/threadweaver/doxygen-footer.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<hr>
-<table width="100%">
- <tr>
- <td style="text-align: center;">ThreadWeaver is (C) 2004 - 2013
- <a href="mailto:Mirko Boehm <mirko@kde.org>">Mirko B&ouml;hm
- </a>
- </td>
- </tr>
-</table>
-
diff --git a/src/3rdparty/threadweaver/internal-doxygen.cfg b/src/3rdparty/threadweaver/internal-doxygen.cfg
deleted file mode 100644
index e1dd01561..000000000
--- a/src/3rdparty/threadweaver/internal-doxygen.cfg
+++ /dev/null
@@ -1,1212 +0,0 @@
-# Doxyfile 1.4.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = ThreadWeaver
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 5.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ./doxydocs/
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = YES
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = YES
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation.
-
-SHOW_DIRECTORIES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from the
-# version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the progam writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = src/Weaver
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = examples
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS = moc_*.cpp
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH = Tests
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER = doxygen-footer.html
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = YES
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that a graph may be further truncated if the graph's
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, which results in a white background.
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/src/3rdparty/threadweaver/src/CMakeLists.txt b/src/3rdparty/threadweaver/src/CMakeLists.txt
deleted file mode 100644
index c571b12df..000000000
--- a/src/3rdparty/threadweaver/src/CMakeLists.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-########### next target ###############
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE_ENABLE_EXCEPTIONS}")
-
-set(ThreadWeaver_LIB_SRCS
- queuesignals.cpp
- queuestream.cpp
- queueapi.cpp
- exception.cpp
- queue.cpp
- weaver.cpp
- debuggingaids.cpp
- thread.cpp
- job.cpp
- iddecorator.cpp
- qobjectdecorator.cpp
- executor.cpp
- executewrapper.cpp
- state.cpp
- weaverimplstate.cpp
- inconstructionstate.cpp
- workinghardstate.cpp
- suspendingstate.cpp
- suspendedstate.cpp
- shuttingdownstate.cpp
- destructedstate.cpp
- collection.cpp
- sequence.cpp
- dependencypolicy.cpp
- dependency.cpp
- resourcerestrictionpolicy.cpp
-)
-
-add_library(KF5ThreadWeaver ${ThreadWeaver_LIB_SRCS})
-generate_export_header(KF5ThreadWeaver BASE_NAME ThreadWeaver)
-add_library(KF5::ThreadWeaver ALIAS KF5ThreadWeaver)
-target_link_libraries(KF5ThreadWeaver PUBLIC Qt5::Core)
-target_include_directories(KF5ThreadWeaver PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
-target_include_directories(KF5ThreadWeaver INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/ThreadWeaver>")
-
-set_target_properties(KF5ThreadWeaver PROPERTIES
- VERSION ${THREADWEAVER_VERSION_STRING}
- SOVERSION ${THREADWEAVER_SOVERSION}
- EXPORT_NAME ThreadWeaver
-)
-install(TARGETS KF5ThreadWeaver EXPORT KF5ThreadWeaverTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
-
-ecm_generate_headers(
- ThreadWeaver
- QueueStream
- Queueing
- Exception
- QueueInterface
- Queue
- DebuggingAids
- Thread
- JobInterface
- Job
- IdDecorator
- QObjectDecorator
- Lambda
- State
- Collection
- Sequence
- Dependency
- DependencyPolicy
- ResourceRestrictionPolicy
- QueueSignals
- QueuePolicy
- JobPointer
- ManagedJobPointer
-
- MODULE_NAME ThreadWeaver
- PREFIX ThreadWeaver
- REQUIRED_HEADERS ThreadWeaver_HEADERS
-)
-install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ThreadWeaver DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
-
-install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/threadweaver_export.h
- ${ThreadWeaver_HEADERS}
- DESTINATION ${INCLUDE_INSTALL_DIR}/ThreadWeaver/threadweaver COMPONENT Devel
-)
diff --git a/src/3rdparty/threadweaver/src/collection.cpp b/src/3rdparty/threadweaver/src/collection.cpp
deleted file mode 100644
index b49cf8a5a..000000000
--- a/src/3rdparty/threadweaver/src/collection.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the Collection class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "collection.h"
-
-#include "queueapi_p.h"
-#include "debuggingaids.h"
-#include "managedjobpointer.h"
-#include "queueing.h"
-
-#include <QtCore/QList>
-#include <QtCore/QObject>
-#include <QtCore/QPointer>
-
-#include "dependencypolicy.h"
-#include "executewrapper_p.h"
-#include "thread.h"
-
-namespace ThreadWeaver
-{
-
-class CollectionExecuteWrapper : public ExecuteWrapper
-{
-public:
- CollectionExecuteWrapper()
- : collection(0)
- {}
-
- void setCollection(Collection *collection_)
- {
- collection = collection_;
- }
-
- void begin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE {
- ExecuteWrapper::begin(job, thread);
- Q_ASSERT(collection);
- collection->elementStarted(job, thread);
- }
-
- void end(JobPointer job, Thread *thread) Q_DECL_OVERRIDE {
- Q_ASSERT(collection);
- collection->elementFinished(job, thread);
- ExecuteWrapper::end(job, thread);
- }
-
- void cleanup(JobPointer job, Thread *) Q_DECL_OVERRIDE {
- //Once job is unwrapped from us, this object is dangling. Job::executor points to the next higher up execute wrapper.
- //It is thus safe to "delete this". By no means add any later steps after delete!
- delete unwrap(job);
- }
-
-private:
- ThreadWeaver::Collection *collection;
-};
-
-class CollectionSelfExecuteWrapper : public ThreadWeaver::ExecuteWrapper
-{
-public:
- void begin(JobPointer, Thread *) Q_DECL_OVERRIDE {
- }
-
- void end(JobPointer, Thread *) Q_DECL_OVERRIDE {
- }
-};
-
-class Collection::Private
-{
-public:
- Private()
- : api(0)
- , jobCounter(0)
- , selfIsExecuting(false)
- {
- }
-
- ~Private()
- {
- }
-
- /* The elements of the collection. */
- QVector<JobPointer> elements;
-
- /* The Weaver interface this collection is queued in. */
- QueueAPI *api;
-
- /* Counter for the finished jobs.
- Set to the number of elements when started.
- When zero, all elements are done.
- */
- QAtomicInt jobCounter;
- QAtomicInt jobsStarted;
- CollectionSelfExecuteWrapper selfExecuteWrapper;
- JobPointer self;
- bool selfIsExecuting;
-};
-
-Collection::Collection()
- : d(new Private)
-{
- d->selfExecuteWrapper.wrap(setExecutor(&d->selfExecuteWrapper));
- CollectionExecuteWrapper *wrapper = new CollectionExecuteWrapper();
- wrapper->setCollection(this);
- wrapper->wrap(setExecutor(wrapper));
-}
-
-Collection::~Collection()
-{
- {
- // dequeue all remaining jobs:
- QMutexLocker l(mutex()); Q_UNUSED(l);
- if (d->api != 0) { // still queued
- dequeueElements(false);
- }
- }
- delete d;
-}
-
-void Collection::addJob(JobPointer job)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- REQUIRE(d->api == 0 || d->selfIsExecuting == true); // not queued yet or still running
- REQUIRE(job != 0);
-
- CollectionExecuteWrapper *wrapper = new CollectionExecuteWrapper();
- wrapper->setCollection(this);
- wrapper->wrap(job->setExecutor(wrapper));
- d->elements.append(job);
-}
-
-void Collection::stop(JobPointer job)
-{
- Q_UNUSED(job);
- QMutexLocker l(mutex()); Q_UNUSED(l);
- if (d->api != 0) {
- debug(4, "Collection::stop: dequeueing %p.\n", (void *)this);
- if (!d->api->dequeue(ManagedJobPointer<Collection>(this))) {
- dequeueElements(false);
- }
- }
-}
-
-void Collection::aboutToBeQueued_locked(QueueAPI *api)
-{
- Q_ASSERT(!mutex()->tryLock());
- Q_ASSERT(d->api == 0); // never queue twice
- d->api = api;
- Job::aboutToBeQueued_locked(api);
-}
-
-void Collection::aboutToBeDequeued_locked(QueueAPI *api)
-{
- Q_ASSERT(!mutex()->tryLock());
- Q_ASSERT(api && d->api == api);
- dequeueElements(true);
- d->api = 0;
- Job::aboutToBeDequeued_locked(api);
-}
-
-void Collection::execute(JobPointer job, Thread *thread)
-{
- {
- QMutexLocker l(mutex()); Q_UNUSED(l);
- Q_ASSERT(d->self.isNull());
- Q_ASSERT(d->api != 0);
- d->self = job;
- d->selfIsExecuting = true; // reset in elementFinished
- }
- Job::execute(job, thread);
-}
-
-void Collection::run(JobPointer, Thread *)
-{
- //empty
-}
-
-void Collection::enqueueElements()
-{
- Q_ASSERT(!mutex()->tryLock());
- d->jobCounter.fetchAndStoreOrdered(d->elements.count() + 1); //including self
- d->api->enqueue(d->elements);
-}
-
-void Collection::elementStarted(JobPointer job, Thread *thread)
-{
- Q_UNUSED(job) // except in Q_ASSERT
-#ifndef NDEBUG // to avoid the mutex in release mode
- Q_ASSERT(!d->self.isNull());
- QMutexLocker l(mutex()); Q_UNUSED(l);
- Q_ASSERT(job.data() == d->self || std::find(d->elements.begin(), d->elements.end(), job) != d->elements.end());
-#endif
- if (d->jobsStarted.fetchAndAddOrdered(1) == 0) {
- //emit started() signal on beginning of first job execution
- executor()->defaultBegin(d->self, thread);
- }
-}
-
-void Collection::elementFinished(JobPointer job, Thread *thread)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- Q_ASSERT(!d->self.isNull());
- Q_UNUSED(job) // except in Q_ASSERT
- //FIXME test this assert with a decorated collection!
- Q_ASSERT(job.data() == d->self || std::find(d->elements.begin(), d->elements.end(), job) != d->elements.end());
- if (d->selfIsExecuting) {
- // the element that is finished is the collection itself
- // the collection is always executed first
- // queue the collection elements:
- enqueueElements();
- d->selfIsExecuting = false;
- }
- const int jobsStarted = d->jobsStarted.loadAcquire();
- Q_ASSERT(jobsStarted >= 0); Q_UNUSED(jobsStarted);
- const int remainingJobs = d->jobCounter.fetchAndAddOrdered(-1) - 1;
- Q_ASSERT(remainingJobs >= 0);
- if (remainingJobs == 0) {
- // all elements can only be done if self has been executed:
- // there is a small chance that (this) has been dequeued in the
- // meantime, in this case, there is nothing left to clean up
- finalCleanup();
- executor()->defaultEnd(d->self, thread);
- l.unlock();
- d->self.clear();
- }
-}
-
-JobPointer Collection::self() const
-{
- return d->self;
-}
-
-JobPointer Collection::jobAt(int i)
-{
- Q_ASSERT(!mutex()->tryLock());
- Q_ASSERT(i >= 0 && i < d->elements.size());
- return d->elements.at(i);
-}
-
-int Collection::jobListLength() const
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- return jobListLength_locked();
-}
-
-int Collection::jobListLength_locked() const
-{
- return d->elements.size();
-}
-
-void Collection::finalCleanup()
-{
- Q_ASSERT(!self().isNull());
- Q_ASSERT(!mutex()->tryLock());
- freeQueuePolicyResources(self());
- setStatus(Status_Success);
- d->api = 0;
-}
-
-Collection &Collection::operator<<(JobInterface *job)
-{
- addJob(make_job(job));
- return *this;
-}
-
-Collection &Collection::operator<<(const JobPointer &job)
-{
- addJob(job);
- return *this;
-}
-
-Collection &Collection::operator<<(JobInterface &job)
-{
- addJob(make_job_raw(&job));
- return *this;
-}
-
-void Collection::dequeueElements(bool queueApiIsLocked)
-{
- // dequeue everything:
- Q_ASSERT(!mutex()->tryLock());
- if (d->api == 0) {
- return; //not queued
- }
-
- for (int index = 0; index < d->elements.size(); ++index) {
- debug(4, "Collection::dequeueElements: dequeueing %p.\n", (void *)d->elements.at(index).data());
- if (queueApiIsLocked) {
- d->api->dequeue_p(d->elements.at(index));
- } else {
- d->api->dequeue(d->elements.at(index));
- }
- }
-
- const int jobCount = d->jobCounter.fetchAndStoreAcquire(0);
- if (jobCount != 0) {
- // if jobCounter is not zero, then we where waiting for the
- // last job to finish before we would have freed our queue
- // policies. In this case we have to do it here:
- finalCleanup();
- }
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/collection.h b/src/3rdparty/threadweaver/src/collection.h
deleted file mode 100644
index 69fd425e6..000000000
--- a/src/3rdparty/threadweaver/src/collection.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the Collection class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef JOBCOLLECTION_H
-#define JOBCOLLECTION_H
-
-#include "job.h"
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class Thread;
-class CollectionExecuteWrapper;
-
-/** A Collection is a vector of Jobs that will be queued together.
- * In a Collection, the order of execution of the elements is not specified.
- *
- * It is intended that the collection is set up first and then
- * queued. After queuing, no further jobs should be added to the collection.
- *
- * Collection emits a done(JobPointer) signal when all of the jobs in the collection
- * have completed.
- */
-class THREADWEAVER_EXPORT Collection : public Job
-{
-public:
- Collection();
- ~Collection();
- /** Append a job to the collection.
- *
- * To use Collection, create the Job objects first, add them to the collection, and then queue it. After
- * the collection has been queued, no further Jobs are supposed to be added.
- *
- * @note Once the job has been added, execute wrappers can no more be set on it */
- virtual void addJob(JobPointer);
-
- /** Stop processing, dequeue all remaining Jobs.
- * job is supposed to be an element of the collection.
- */
- //FIXME remove job argument?
- void stop(ThreadWeaver::JobPointer job);
-
- /** Return the number of jobs in the joblist. */
- int jobListLength() const;
-
- /** @brief Add the job to this collection by pointer. */
- Collection &operator<<(ThreadWeaver::JobInterface *job);
-
- /** @brief Add the job to this collection. */
- Collection &operator<<(const ThreadWeaver::JobPointer &job);
- Collection &operator<<(JobInterface &job);
-
-protected:
- /** Overload to queue the collection. */
- void aboutToBeQueued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Overload to dequeue the collection. */
- void aboutToBeDequeued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Return a ref-erence to the job in the job list at position i. */
- JobPointer jobAt(int i);
-
- /** Return the number of jobs in the joblist.
- * Assumes that the mutex is being held.
- */
- virtual int jobListLength_locked() const;
-
- /** Perform the task usually done when one individual job is
- * finished, but in our case only when the whole collection
- * is finished or partly dequeued.
- */
- void finalCleanup();
-
-protected:
- friend class CollectionExecuteWrapper;
- virtual void elementStarted(JobPointer job, Thread *thread);
- virtual void elementFinished(JobPointer job, Thread *thread);
-
- //FIXME needed when using BlockExecutionPolicy?
- JobPointer self() const;
-
-protected:
- /** Overload the execute method. */
- void execute(JobPointer job, Thread *) Q_DECL_OVERRIDE;
-
- /** Overload run().
- * We have to. */
- void run(JobPointer self, Thread *thread) Q_DECL_OVERRIDE;
-
- /** @brief Enqueue the elements of the collection. */
- virtual void enqueueElements();
-
-private:
- /** Dequeue all elements of the collection.
- * Note: This will not dequeue the collection itself.
- */
- void dequeueElements(bool queueApiIsLocked);
-
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/debuggingaids.cpp b/src/3rdparty/threadweaver/src/debuggingaids.cpp
deleted file mode 100644
index 18e89bd6c..000000000
--- a/src/3rdparty/threadweaver/src/debuggingaids.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- C++ -*-
-
- This file implements debugging aids for multithreaded applications.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "debuggingaids.h"
-
-#include <QtCore/QMutex>
-
-#include <threadweaver_export.h>
-
-/** A global mutex for the ThreadWeaver objects.
- Generally, you should not use it in your own code. */
-THREADWEAVER_EXPORT QMutex ThreadWeaver::GlobalMutex;
-THREADWEAVER_EXPORT bool ThreadWeaver::Debug = true;
-THREADWEAVER_EXPORT int ThreadWeaver::DebugLevel = 01;
diff --git a/src/3rdparty/threadweaver/src/debuggingaids.h b/src/3rdparty/threadweaver/src/debuggingaids.h
deleted file mode 100644
index 2f0d41c3d..000000000
--- a/src/3rdparty/threadweaver/src/debuggingaids.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* -*- C++ -*-
-
- This file declares debugging aids for multithreaded applications.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-//krazy:excludeall=inline
-
-#ifndef DEBUGGINGAIDS_H
-#define DEBUGGINGAIDS_H
-
-#include <QtCore/QtGlobal>
-
-extern "C"
-{
-#include <stdarg.h>
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-}
-
-#include <QtCore/QMutex>
-#include <QtCore/QString>
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-extern THREADWEAVER_EXPORT bool Debug;
-extern THREADWEAVER_EXPORT int DebugLevel;
-extern THREADWEAVER_EXPORT QMutex GlobalMutex;
-
-/** Set the debug log level.
-@see debug
-*/
-extern inline void setDebugLevel(bool debug, int level);
-
-/** This method prints a text message on the screen, if debugging is
-enabled. Otherwise, it does nothing. The message is thread safe,
-therefore providing that the messages appear in the order they where
-issued by the different threads.
-All messages are suppressed when Debug is false. All messages with a
-lower importance (higher number) than DebugLevel will be suppressed,
-too. Debug level 0 messages will always be printed as long as
-Debug is true.
- We use our own debugging method, since debugging threads is a more
- complicated experience than debugging single threaded
- contexts. This might change in future in the way that debug
- prints its messages to another logging facility provided by
- the platform.
-Use setDebugLevel () to integrate adapt debug () to your platform.
-*/
-inline void debug(int severity, const char *cformat, ...)
-#ifdef __GNUC__
-__attribute__((format(printf, 2, 3)))
-#endif
-;
-
-/** Prints the message to the console if condition is true. */
-inline void debug(bool condition, int severity, const char *cformat, ...)
-#ifdef __GNUC__
-__attribute__((format(printf, 3, 4)))
-#endif
-;
-
-/** PROTECT executes x with GlobalMutex locked.
- Mostly used for debugging, as in P_ASSERT. */
-#ifdef PROTECT
-#undef PROTECT
-#endif
-#define PROTECT(x) do { QMutexLocker l(&ThreadWeaver::GlobalMutex); (x); } while (0)
-
-/** P_ASSERT ensures that error messages occur in the correct order. */
-#ifdef P_ASSERT
-#undef P_ASSERT
-#endif
-
-#define P_ASSERT(x) do { QMutexLocker l(&ThreadWeaver::GlobalMutex); Q_ASSERT(x); } while (0)
-
-inline void setDebugLevel(bool debug, int level)
-{
- Debug = debug;
- DebugLevel = level;
-}
-
-#ifndef QT_NO_DEBUG
-inline void debug(int severity, const char *cformat, ...)
-{
- if (Debug == true && (severity <= DebugLevel || severity == 0)) {
- QString text;
-
- va_list ap;
- va_start(ap, cformat);
- PROTECT(vprintf(cformat, ap));
- va_end(ap);
- }
-}
-
-inline void debug(bool condition, int severity, const char *cformat, ...)
-{
- if (condition && Debug == true && (severity <= DebugLevel || severity == 0)) {
- QString text;
-
- va_list ap;
- va_start(ap, cformat);
- PROTECT(vprintf(cformat, ap));
- va_end(ap);
- }
-}
-#else
-inline void debug(int, const char *, ...) {}
-inline void debug(bool, int, const char *, ...) {}
-#endif
-
-inline bool invariant()
-{
- return true;
-}
-
-#define INVARIANT Q_ASSERT_X (invariant(), __FILE__, "class invariant failed" );
-
-#define REQUIRE(x) \
- INVARIANT \
- Q_ASSERT_X (x, Q_FUNC_INFO, "unfulfilled requirement " #x );
-
-#define ENSURE(x) \
- INVARIANT \
- Q_ASSERT_X (x, Q_FUNC_INFO, "broken guarantee " #x );
-
-#ifdef QT_NO_DEBUG
-#define DEBUGONLY(x)
-#else
-#define DEBUGONLY(x) x
-#endif
-
-}
-
-#endif // DEBUGGINGAIDS_H
diff --git a/src/3rdparty/threadweaver/src/dependency.cpp b/src/3rdparty/threadweaver/src/dependency.cpp
deleted file mode 100644
index 99d0649c0..000000000
--- a/src/3rdparty/threadweaver/src/dependency.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- C++ -*-
-
- A dependency between jobs.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "dependency.h"
-#include "jobinterface.h"
-#include "managedjobpointer.h"
-
-namespace ThreadWeaver
-{
-
-Dependency::Dependency(const JobPointer &dependent, const JobPointer &dependee)
- : m_dependent(dependent)
- , m_dependee(dependee)
-{
-}
-
-Dependency::Dependency(JobInterface *dependent, JobInterface *dependee)
- : m_dependent(ManagedJobPointer<JobInterface>(dependent))
- , m_dependee(ManagedJobPointer<JobInterface>(dependee))
-{
-}
-
-Dependency::Dependency(const JobPointer &dependent, JobInterface *dependee)
- : m_dependent(dependent)
- , m_dependee(ManagedJobPointer<JobInterface>(dependee))
-{
-}
-
-Dependency::Dependency(JobInterface *dependent, const JobPointer &dependee)
- : m_dependent(ManagedJobPointer<JobInterface>(dependent))
- , m_dependee(dependee)
-{
-}
-
-JobPointer Dependency::dependent() const
-{
- return m_dependent;
-}
-
-JobPointer Dependency::dependee() const
-{
- return m_dependee;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/dependency.h b/src/3rdparty/threadweaver/src/dependency.h
deleted file mode 100644
index 0a475949d..000000000
--- a/src/3rdparty/threadweaver/src/dependency.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- C++ -*-
-
- A dependency between jobs.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef DEPENDENCY_H
-#define DEPENDENCY_H
-
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-
-class THREADWEAVER_EXPORT Dependency
-{
-public:
- explicit Dependency(const JobPointer &dependent, const JobPointer &dependee);
- explicit Dependency(JobInterface *dependent, JobInterface *dependee);
- explicit Dependency(const JobPointer &dependent, JobInterface *dependee);
- explicit Dependency(JobInterface *dependent, const JobPointer &dependee);
-
- JobPointer dependent() const;
- JobPointer dependee() const;
-private:
- const JobPointer m_dependent;
- const JobPointer m_dependee;
-};
-
-}
-
-#endif // DEPENDENCY_H
diff --git a/src/3rdparty/threadweaver/src/dependencypolicy.cpp b/src/3rdparty/threadweaver/src/dependencypolicy.cpp
deleted file mode 100644
index 22c093a78..000000000
--- a/src/3rdparty/threadweaver/src/dependencypolicy.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the DependencyPolicy class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: DebuggingAids.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "dependencypolicy.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QMutex>
-#include <QtCore/QDebug>
-
-#include "job.h"
-#include "debuggingaids.h"
-#include "managedjobpointer.h"
-
-#include "dependency.h"
-
-using namespace ThreadWeaver;
-
-typedef QMultiMap<JobPointer, JobPointer> JobMultiMap;
-
-class DependencyPolicy::Private
-{
-public:
- /** A container to keep track of Job dependencies.
- * For each dependency A->B, which means Job B depends on Job A and may only be executed after A has been
- * finished, an entry will be added with key A and value B. When A is finished, the entry will be removed.
- */
- JobMultiMap &dependencies()
- {
- return depMap_;
- }
-
- QMutex *mutex()
- {
- return &mutex_;
- }
-
- JobMultiMap depMap_;
- QMutex mutex_;
-};
-
-DependencyPolicy::DependencyPolicy()
- : QueuePolicy()
- , d(new Private())
-{
-}
-
-DependencyPolicy::~DependencyPolicy()
-{
- delete d;
-}
-
-void DependencyPolicy::addDependency(JobPointer jobA, JobPointer jobB)
-{
- // jobA depends on jobB
- REQUIRE(jobA != 0 && jobB != 0 && jobA != jobB);
-
- jobA->assignQueuePolicy(this);
- jobB->assignQueuePolicy(this);
- QMutexLocker l(d->mutex());
- d->dependencies().insert(jobA, jobB);
-
- ENSURE(d->dependencies().contains(jobA));
-}
-
-void DependencyPolicy::addDependency(const Dependency &dep)
-{
- addDependency(dep.dependent(), dep.dependee());
-}
-
-bool DependencyPolicy::removeDependency(JobPointer jobA, JobPointer jobB)
-{
- REQUIRE(jobA != 0 && jobB != 0);
- bool result = false;
- QMutexLocker l(d->mutex());
-
- // there may be only one (!) occurrence of [this, dep]:
- QMutableMapIterator<JobPointer, JobPointer> it(d->dependencies());
- while (it.hasNext()) {
- it.next();
- if (it.key() == jobA && it.value() == jobB) {
- it.remove();
- result = true;
- break;
- }
- }
-
- ENSURE(! d->dependencies().keys(jobB).contains(jobA));
- return result;
-}
-
-bool DependencyPolicy::removeDependency(const Dependency &dep)
-{
- return removeDependency(dep.dependent(), dep.dependee());
-}
-
-void DependencyPolicy::resolveDependencies(JobPointer job)
-{
- if (job->success()) {
- QMutexLocker l(d->mutex());
- QMutableMapIterator<JobPointer, JobPointer> it(d->dependencies());
- // there has to be a better way to do this: (?)
- while (it.hasNext()) { // we remove all entries where jobs depend on *this* :
- it.next();
- if (it.value() == job) {
- it.remove();
- }
- }
- }
-}
-
-//QList<JobPointer> DependencyPolicy::getDependencies(JobPointer job) const
-//{
-// REQUIRE (job != 0);
-// QList<JobInterface*> result;
-// JobMultiMap::const_iterator it;
-// QMutexLocker l( & d->mutex() );
-
-// for ( it = d->dependencies().constBegin(); it != d->dependencies().constEnd(); ++it )
-// {
-// if ( it.key() == job )
-// {
-// result.append( it.value() );
-// }
-// }
-// return result;
-//}
-
-bool DependencyPolicy::hasUnresolvedDependencies(JobPointer job) const
-{
- REQUIRE(job != 0);
- QMutexLocker l(d->mutex());
- return d->dependencies().contains(job);
-}
-
-DependencyPolicy &DependencyPolicy::instance()
-{
- static DependencyPolicy policy;
- return policy;
-}
-
-bool DependencyPolicy::canRun(JobPointer job)
-{
- REQUIRE(job != 0);
- return !hasUnresolvedDependencies(job);
-}
-
-void DependencyPolicy::free(JobPointer job)
-{
- REQUIRE(job != 0);
- REQUIRE(job->status() > Job::Status_Running);
- if (job->success()) {
- resolveDependencies(job);
- debug(3, "DependencyPolicy::free: dependencies resolved for job %p.\n", (void *)job.data());
- } else {
- debug(3, "DependencyPolicy::free: not resolving dependencies for %p (execution not successful).\n",
- (void *)job.data());
- }
- ENSURE((!hasUnresolvedDependencies(job) && job->success()) || !job->success());
-}
-
-void DependencyPolicy::release(JobPointer job)
-{
- REQUIRE(job != 0); Q_UNUSED(job)
-}
-
-void DependencyPolicy::destructed(JobInterface *job)
-{
- REQUIRE(job != 0);
- resolveDependencies(ManagedJobPointer<JobInterface>(job));
-}
-
-//void DependencyPolicy::dumpJobDependencies()
-//{
-// QMutexLocker l( & d->mutex() );
-
-// debug ( 0, "Job Dependencies (left depends on right side):\n" );
-// for ( JobMultiMap::const_iterator it = d->dependencies().constBegin(); it != d->dependencies().constEnd(); ++it )
-// {
-// debug( 0, " : %p <-- %p\n", (void*)it.key(), (void*)it.value());
-// }
-// debug ( 0, "-----------------\n" );
-//}
-
diff --git a/src/3rdparty/threadweaver/src/dependencypolicy.h b/src/3rdparty/threadweaver/src/dependencypolicy.h
deleted file mode 100644
index 91190ccaf..000000000
--- a/src/3rdparty/threadweaver/src/dependencypolicy.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the DependencyPolicy class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#ifndef DEPENDENCYPOLICY_H
-#define DEPENDENCYPOLICY_H
-
-#include <QtGlobal>
-
-//template <typename T> class QList;
-
-#include "queuepolicy.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-class Dependency;
-
-/** @brief DependencyPolicy implements execution-time dependencies dependencies between Jobs.
- *
- * To declare that Job B can only be executed when Job A is finished, call addDependency.
- *
- * Be aware of circular dependencies. All dependencies on a Job will be removed if the Job object is destructed.
- * Sequence uses dependencies to implement the ordered execution of the sequence elements.
- */
-class THREADWEAVER_EXPORT DependencyPolicy : public QueuePolicy
-{
-public:
- /** Destructor. */
- ~DependencyPolicy();
-
- /** @brief Add jobB as a dependency of jobA.
- * jobA will only be executed after jobB has been successfully processed.
- * @param jobA the depending job
- * @param jobB the job jobA depends on
- */
- void addDependency(JobPointer jobA, JobPointer jobB);
- void addDependency(const Dependency &dep);
-
- /** @brief Remove a dependency.
- * The dependency of jobA on jobB is removed. If no dependencies are left for jobA, canRun will return true.
- * Returns false if the given object is not dependency of this job.
- * @param jobA the depending job
- * @param jobB the job jobA depends on
- * @return true if dependency existed, false otherwise
- */
- bool removeDependency(JobPointer jobA, JobPointer jobB);
- bool removeDependency(const Dependency &dep);
-
- /** @brief Resolve all dependencies for a job.
- * This method is called after the Job has been finished, or when it is deleted without being executed (performed by the
- * destructor). The method will remove all entries stating that another Job depends on this one.
- */
- void resolveDependencies(JobPointer);
-
- //FIXME remove
-// /** @brief Retrieve a list of dependencies of this job. */
-// QList<JobPointer> getDependencies(JobPointer) const;
-
- static DependencyPolicy &instance();
-
- bool canRun(JobPointer) Q_DECL_OVERRIDE;
-
- void free(JobPointer) Q_DECL_OVERRIDE;
-
- void release(JobPointer) Q_DECL_OVERRIDE;
-
- void destructed(JobInterface *job) Q_DECL_OVERRIDE;
-
-protected:
- /** @brief Query whether the job has an unresolved dependency.
- * In case it does, the policy will return false from canRun().
- */
- bool hasUnresolvedDependencies(JobPointer) const;
-
-private:
- DependencyPolicy();
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/destructedstate.cpp b/src/3rdparty/threadweaver/src/destructedstate.cpp
deleted file mode 100644
index e269b6d77..000000000
--- a/src/3rdparty/threadweaver/src/destructedstate.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the DestructedState class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: DestructedState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "destructedstate_p.h"
-
-namespace ThreadWeaver
-{
-
-DestructedState::DestructedState(QueueSignals *)
- : WeaverImplState(0) // make sure we cannot use weaver, ever :-)
-{
-}
-
-void DestructedState::shutDown()
-{
-}
-
-Weaver *DestructedState::weaver()
-{
- return 0;
-}
-
-const Weaver *DestructedState::weaver() const
-{
- return 0;
-}
-
-void DestructedState::setMaximumNumberOfThreads(int)
-{
-}
-
-int DestructedState::maximumNumberOfThreads() const
-{
- return 0;
-}
-
-int DestructedState::currentNumberOfThreads() const
-{
- return 0;
-}
-
-void DestructedState::enqueue(const QVector<JobPointer> &)
-{
-}
-
-bool DestructedState::dequeue(const JobPointer &)
-{
- return false;
-}
-
-void DestructedState::dequeue()
-{
-}
-
-void DestructedState::finish()
-{
-}
-
-bool DestructedState::isEmpty() const
-{
- return true;
-}
-
-bool DestructedState::isIdle() const
-{
- return true;
-}
-
-int DestructedState::queueLength() const
-{
- return 0;
-}
-
-void DestructedState::requestAbort()
-{
-}
-
-void DestructedState::suspend()
-{
-}
-
-void DestructedState::resume()
-{
-}
-
-JobPointer DestructedState::applyForWork(Thread *, bool wasBusy)
-{
- Q_UNUSED(wasBusy) // except in Q_ASSERT
- Q_ASSERT(wasBusy == false);
- return JobPointer();
-}
-
-void DestructedState::waitForAvailableJob(Thread *)
-{
-}
-
-StateId DestructedState::stateId() const
-{
- return Destructed;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/destructedstate_p.h b/src/3rdparty/threadweaver/src/destructedstate_p.h
deleted file mode 100644
index 278fbf5b6..000000000
--- a/src/3rdparty/threadweaver/src/destructedstate_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the DestructedState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DestructedState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef DestructedState_H
-#define DestructedState_H
-
-#include "weaverimplstate_p.h"
-
-namespace ThreadWeaver
-{
-
-class QueueSignals;
-
-/** DestructedState is only active after the thread have been destroyed by
- * the destructor, but before superclass destructors have finished.
- */
-class DestructedState : public WeaverImplState
-{
-public:
- explicit DestructedState(QueueSignals *weaver);
- void shutDown() Q_DECL_OVERRIDE;
- Weaver *weaver() Q_DECL_OVERRIDE;
- const Weaver *weaver() const Q_DECL_OVERRIDE;
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
- void enqueue(const QVector<JobPointer> &job) Q_DECL_OVERRIDE;
- bool dequeue(const JobPointer &job) Q_DECL_OVERRIDE;
- void dequeue() Q_DECL_OVERRIDE;
- void finish() Q_DECL_OVERRIDE;
- bool isEmpty() const Q_DECL_OVERRIDE;
- bool isIdle() const Q_DECL_OVERRIDE;
- int queueLength() const Q_DECL_OVERRIDE;
- void requestAbort() Q_DECL_OVERRIDE;
- void suspend() Q_DECL_OVERRIDE;
- void resume() Q_DECL_OVERRIDE;
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // DestructedState_H
diff --git a/src/3rdparty/threadweaver/src/exception.cpp b/src/3rdparty/threadweaver/src/exception.cpp
deleted file mode 100644
index 41ffdcc23..000000000
--- a/src/3rdparty/threadweaver/src/exception.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- Base class for exceptions in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-
-#include "exception.h"
-
-namespace ThreadWeaver
-{
-
-Exception::Exception(const QString &message)
- : std::runtime_error(message.toStdString())
- , m_message(message)
-{
-}
-
-Exception::~Exception() throw() {}
-
-QString Exception::message() const
-{
- return m_message;
-}
-
-JobAborted::JobAborted(const QString &message)
- : Exception(message)
-{
-}
-
-JobFailed::JobFailed(const QString &message)
- : Exception(message)
-{
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/exception.h b/src/3rdparty/threadweaver/src/exception.h
deleted file mode 100644
index b3ee3ce2c..000000000
--- a/src/3rdparty/threadweaver/src/exception.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- C++ -*-
-
- Base class for exceptions in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef EXCEPTION_H
-#define EXCEPTION_H
-
-#include <stdexcept>
-
-#include <QString>
-
-#include <threadweaver_export.h>
-
-namespace ThreadWeaver
-{
-
-class THREADWEAVER_EXPORT Exception : public std::runtime_error
-{
-public:
- explicit Exception(const QString &message = QString());
- ~Exception() throw();
- QString message() const;
-
-private:
- QString m_message;
-};
-
-class THREADWEAVER_EXPORT JobAborted : public Exception
-{
-public:
- explicit JobAborted(const QString &message = QString());
-};
-
-class THREADWEAVER_EXPORT JobFailed : public Exception
-{
-public:
- explicit JobFailed(const QString &message = QString());
-};
-
-}
-
-#endif // EXCEPTION_H
diff --git a/src/3rdparty/threadweaver/src/executewrapper.cpp b/src/3rdparty/threadweaver/src/executewrapper.cpp
deleted file mode 100644
index ce5e41e21..000000000
--- a/src/3rdparty/threadweaver/src/executewrapper.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "executewrapper_p.h"
-
-namespace ThreadWeaver
-{
-
-ExecuteWrapper::ExecuteWrapper()
-{
-}
-
-Executor *ExecuteWrapper::wrap(Executor *previous)
-{
- return wrapped.fetchAndStoreOrdered(previous);
-}
-
-Executor *ExecuteWrapper::unwrap(JobPointer job)
-{
- Executor *executor = job->setExecutor(wrapped.fetchAndAddOrdered(0));
- Q_ASSERT_X(executor == this, Q_FUNC_INFO, "ExecuteWrapper can only unwrap itself!");
- wrapped.fetchAndStoreOrdered(0);
- return executor;
-}
-
-void ExecuteWrapper::begin(JobPointer job, Thread *thread)
-{
- Q_ASSERT(wrapped.loadAcquire() != 0);
- wrapped.loadAcquire()->begin(job, thread);
-}
-
-void ExecuteWrapper::execute(JobPointer job, Thread *thread)
-{
- executeWrapped(job, thread);
-}
-
-void ExecuteWrapper::executeWrapped(JobPointer job, Thread *thread)
-{
- Executor *executor = wrapped.loadAcquire();
- Q_ASSERT_X(executor != 0, Q_FUNC_INFO, "Wrapped Executor cannot be zero!");
- executor->execute(job, thread);
-}
-
-void ExecuteWrapper::end(JobPointer job, Thread *thread)
-{
- Q_ASSERT(wrapped.loadAcquire() != 0);
- wrapped.loadAcquire()->end(job, thread);
-}
-
-}
-
-#include "executewrapper_p.h"
diff --git a/src/3rdparty/threadweaver/src/executewrapper_p.h b/src/3rdparty/threadweaver/src/executewrapper_p.h
deleted file mode 100644
index 36480e540..000000000
--- a/src/3rdparty/threadweaver/src/executewrapper_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef EXECUTEWRAPPER_H
-#define EXECUTEWRAPPER_H
-
-#include <QAtomicPointer>
-
-#include "job.h"
-#include "executor_p.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-//FIXME Pimpl, make part of the API, document
-//Find a way to avoid new/delete operation, this is rather performance sensitive area
-class ExecuteWrapper : public Executor
-{
-public:
- ExecuteWrapper();
- Executor *wrap(Executor *previous);
- Executor *unwrap(JobPointer job);
- void begin(JobPointer job, Thread *) Q_DECL_OVERRIDE;
- void execute(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void executeWrapped(JobPointer job, Thread *thread);
- void end(JobPointer job, Thread *) Q_DECL_OVERRIDE;
-
-private:
- QAtomicPointer<Executor> wrapped;
-};
-
-}
-
-#endif // EXECUTEWRAPPER_H
diff --git a/src/3rdparty/threadweaver/src/executor.cpp b/src/3rdparty/threadweaver/src/executor.cpp
deleted file mode 100644
index 8203c779e..000000000
--- a/src/3rdparty/threadweaver/src/executor.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "executor_p.h"
-
-namespace ThreadWeaver
-{
-
-Executor::~Executor()
-{
-}
-
-void Executor::defaultBegin(JobPointer job, Thread *thread)
-{
- job->defaultBegin(job, thread);
-}
-
-void Executor::defaultEnd(JobPointer job, Thread *thread)
-{
- job->defaultEnd(job, thread);
-}
-
-void Executor::cleanup(JobPointer, Thread *)
-{
-}
-
-void Executor::run(JobPointer job, Thread *thread)
-{
- job->run(job, thread);
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/executor_p.h b/src/3rdparty/threadweaver/src/executor_p.h
deleted file mode 100644
index d9f440f5e..000000000
--- a/src/3rdparty/threadweaver/src/executor_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- Class to manipulate job execution in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef EXECUTOR_H
-#define EXECUTOR_H
-
-#include "job.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-//FIXME Pimpl, make part of the API, document
-//TODO can JobPointer references be used?
-class Executor
-{
-public:
- virtual ~Executor();
- virtual void begin(JobPointer, Thread *) = 0;
- void defaultBegin(JobPointer job, Thread *thread);
- virtual void execute(JobPointer, Thread *) = 0;
- virtual void end(JobPointer, Thread *) = 0;
- void defaultEnd(JobPointer job, Thread *thread);
- virtual void cleanup(JobPointer, Thread *);
-
- void run(JobPointer job, Thread *thread);
-};
-
-}
-
-#endif // EXECUTOR_H
diff --git a/src/3rdparty/threadweaver/src/iddecorator.cpp b/src/3rdparty/threadweaver/src/iddecorator.cpp
deleted file mode 100644
index 12194af0d..000000000
--- a/src/3rdparty/threadweaver/src/iddecorator.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- C++ -*-
-
- Base class for job decorators in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "collection.h"
-#include "sequence.h"
-#include "managedjobpointer.h"
-
-#include "iddecorator.h"
-
-namespace ThreadWeaver
-{
-
-const int IdDecorator_AutoDelete = 1;
-
-// Pssst: IdDecorator uses the d pointer to hold decoratee. It also uses d2 as a bitfield to store the
-// autoDelete setting. The goal is not to require a dynamic allocation on creation.
-IdDecorator::IdDecorator(JobInterface *decoratee, bool autoDelete)
- : d1(reinterpret_cast<Private1 *>(decoratee))
- , d2(0)
-{
- setAutoDelete(autoDelete);
-}
-
-IdDecorator::~IdDecorator()
-{
- // Do not assert here. IdDecorator can decorate a null pointer. Only assert if a method is called on a decorared
- // null pointer.
- if (autoDelete()) {
- delete job();
- }
-}
-
-QMutex *IdDecorator::mutex() const
-{
- Q_ASSERT(d1);
- return job()->mutex();
-}
-
-void IdDecorator::run(JobPointer self, Thread *thread)
-{
- Q_ASSERT(d1);
- job()->run(self, thread);
-}
-
-void IdDecorator::defaultBegin(JobPointer self, Thread *thread)
-{
- Q_ASSERT(d1);
- job()->defaultBegin(self, thread);
-}
-
-void IdDecorator::defaultEnd(JobPointer self, Thread *thread)
-{
- Q_ASSERT(d1);
- job()->defaultEnd(self, thread);
-}
-
-void IdDecorator::freeQueuePolicyResources(JobPointer j)
-{
- Q_ASSERT(d1);
- job()->freeQueuePolicyResources(j);
-}
-
-void IdDecorator::removeQueuePolicy(QueuePolicy *policy)
-{
- Q_ASSERT(d1);
- job()->removeQueuePolicy(policy);
-}
-
-QList<QueuePolicy *> IdDecorator::queuePolicies() const
-{
- Q_ASSERT(d1);
- return job()->queuePolicies();
-}
-
-void IdDecorator::assignQueuePolicy(QueuePolicy *policy)
-{
- Q_ASSERT(d1);
- job()->assignQueuePolicy(policy);
-}
-
-bool IdDecorator::isFinished() const
-{
- Q_ASSERT(d1);
- return job()->isFinished();
-}
-
-void IdDecorator::aboutToBeQueued(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeQueued(api);
-}
-
-void IdDecorator::aboutToBeQueued_locked(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeQueued_locked(api);
-}
-
-void IdDecorator::aboutToBeDequeued(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeDequeued(api);
-}
-
-void IdDecorator::aboutToBeDequeued_locked(QueueAPI *api)
-{
- Q_ASSERT(d1);
- job()->aboutToBeDequeued_locked(api);
-}
-
-void IdDecorator::requestAbort()
-{
- Q_ASSERT(d1);
- job()->requestAbort();
-}
-
-bool IdDecorator::success() const
-{
- Q_ASSERT(d1);
- return job()->success();
-}
-
-int IdDecorator::priority() const
-{
- Q_ASSERT(d1);
- return job()->priority();
-}
-
-void IdDecorator::setStatus(JobInterface::Status status)
-{
- Q_ASSERT(d1);
- job()->setStatus(status);
-}
-
-JobInterface::Status IdDecorator::status() const
-{
- Q_ASSERT(d1);
- return job()->status();
-}
-
-Executor *IdDecorator::executor() const
-{
- Q_ASSERT(d1);
- return job()->executor();
-}
-
-Executor *IdDecorator::setExecutor(Executor *executor)
-{
- Q_ASSERT(d1);
- return job()->setExecutor(executor);
-}
-
-void IdDecorator::execute(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread)
-{
- Q_ASSERT(d1);
- job()->execute(self, thread);
-}
-
-void IdDecorator::blockingExecute()
-{
- Q_ASSERT(d1);
- job()->blockingExecute();
-}
-
-const ThreadWeaver::JobInterface *IdDecorator::job() const
-{
- return reinterpret_cast<JobInterface *>(d1);
-}
-
-JobInterface *IdDecorator::job()
-{
- return reinterpret_cast<JobInterface *>(d1);
-}
-
-void IdDecorator::setAutoDelete(bool onOff)
-{
-
- if (onOff) {
- d2 = reinterpret_cast<IdDecorator::Private2 *>(IdDecorator_AutoDelete);
- } else {
- d2 = 0;
- }
-}
-
-bool IdDecorator::autoDelete() const
-{
- return d2 == reinterpret_cast<IdDecorator::Private2 *>(IdDecorator_AutoDelete);
-}
-
-const ThreadWeaver::Collection *IdDecorator::collection() const
-{
- return dynamic_cast<const Collection *>(job());
-}
-
-Collection *IdDecorator::collection()
-{
- return dynamic_cast<Collection *>(job());
-}
-
-const Sequence *IdDecorator::sequence() const
-{
- return dynamic_cast<const Sequence *>(job());
-}
-
-Sequence *IdDecorator::sequence()
-{
- return dynamic_cast<Sequence *>(job());
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/iddecorator.h b/src/3rdparty/threadweaver/src/iddecorator.h
deleted file mode 100644
index b65908fbd..000000000
--- a/src/3rdparty/threadweaver/src/iddecorator.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- C++ -*-
-
- Base class for job decorators in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef THREADWEAVER_IDDECORATOR_H
-#define THREADWEAVER_IDDECORATOR_H
-
-#include <QObject>
-
-#include "threadweaver_export.h"
-#include "jobinterface.h"
-
-namespace ThreadWeaver
-{
-
-class Collection;
-class Sequence;
-
-/** @brief IdDecorator decorates a job without changing it's behaviour.
- *
- * It is supposed to be used as the base class for actual decorators that do change the behaviour of jobs. */
-class THREADWEAVER_EXPORT IdDecorator : public JobInterface
-{
-public:
- explicit IdDecorator(JobInterface *job, bool autoDelete = true);
- ~IdDecorator();
- /** Retrieve the decorated job. */
- const JobInterface *job() const;
- /** Retrieve the decorated job. */
- JobInterface *job();
- /** Auto-delete the decoratee or not. */
- void setAutoDelete(bool onOff);
- /** Will the decoratee be auto-deleted? */
- bool autoDelete() const;
- /** Retrieve the decorated job as a Collection.
- * If the decorated Job is not a Collection, 0 is returned. */
- const Collection *collection() const;
- /** Retrieve the decorated job as a Collection.
- * If the decorated Job is not a Collection, 0 is returned. */
- Collection *collection();
- /** Retrieve the decorated job as a Sequence.
- * If the decorated Job is not a Sequence, 0 is returned. */
- const Sequence *sequence() const;
- /** Retrieve the decorated job as a Sequence.
- * If the decorated Job is not a Sequence, 0 is returned. */
- Sequence *sequence();
-
- void execute(JobPointer job, Thread *) Q_DECL_OVERRIDE;
- void blockingExecute() Q_DECL_OVERRIDE;
- Executor *setExecutor(Executor *executor) Q_DECL_OVERRIDE;
- Executor *executor() const Q_DECL_OVERRIDE;
- int priority() const Q_DECL_OVERRIDE;
- void setStatus(Status) Q_DECL_OVERRIDE;
- Status status() const Q_DECL_OVERRIDE;
- bool success() const Q_DECL_OVERRIDE;
- void requestAbort() Q_DECL_OVERRIDE;
- void aboutToBeQueued(QueueAPI *api) Q_DECL_OVERRIDE;
- void aboutToBeQueued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
- void aboutToBeDequeued(QueueAPI *api) Q_DECL_OVERRIDE;
- void aboutToBeDequeued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
- bool isFinished() const Q_DECL_OVERRIDE;
- void assignQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
- void removeQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
- QList<QueuePolicy *> queuePolicies() const Q_DECL_OVERRIDE;
-
-protected:
- void freeQueuePolicyResources(JobPointer) Q_DECL_OVERRIDE;
- void run(JobPointer self, Thread *thread) Q_DECL_OVERRIDE;
- void defaultBegin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void defaultEnd(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-
- QMutex *mutex() const Q_DECL_OVERRIDE;
-
-private:
- class Private1;
- Private1 *const d1;
- class Private2;
- Private2 *d2;
-};
-
-}
-
-#endif // THREADWEAVER_IDDECORATOR_H
diff --git a/src/3rdparty/threadweaver/src/inconstructionstate.cpp b/src/3rdparty/threadweaver/src/inconstructionstate.cpp
deleted file mode 100644
index 757ac5b7b..000000000
--- a/src/3rdparty/threadweaver/src/inconstructionstate.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the InConstructionState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: InConstructionState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "inconstructionstate_p.h"
-
-#include "weaver_p.h"
-#include "threadweaver.h"
-
-namespace ThreadWeaver
-{
-
-InConstructionState::InConstructionState(QueueSignals *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void InConstructionState::suspend()
-{
- // this request is not handled in InConstruction state
-}
-
-void InConstructionState::resume()
-{
- // this request is not handled in InConstruction state
-}
-
-JobPointer InConstructionState::applyForWork(Thread *th, bool wasBusy)
-{
- Q_ASSERT(wasBusy == false);
- // As long as we are in the construction state, no jobs will be given
- // to the worker threads. The threads will be suspended. They will
- // return from the blocked state when jobs are queued. By then, we
- // should not be in InConstruction state anymore, and we hand the job
- // application over to the then active state.
- while (weaver()->state()->stateId() == InConstruction) {
- weaver()->waitForAvailableJob(th);
- }
- return weaver()->applyForWork(th, wasBusy);
-}
-
-StateId InConstructionState::stateId() const
-{
- return InConstruction;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/inconstructionstate_p.h b/src/3rdparty/threadweaver/src/inconstructionstate_p.h
deleted file mode 100644
index bceab67d6..000000000
--- a/src/3rdparty/threadweaver/src/inconstructionstate_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the InConstructionState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: InConstructionState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef InConstructionState_H
-#define InConstructionState_H
-
-#include "weaverimplstate_p.h"
-
-namespace ThreadWeaver
-{
-
-class Weaver;
-class Queue;
-
-/** InConstructionState handles the calls to the Weaver
- object until the constructor has finished.
- */
-class InConstructionState : public WeaverImplState
-{
-public:
- explicit InConstructionState(QueueSignals *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // InConstructionState_H
diff --git a/src/3rdparty/threadweaver/src/job.cpp b/src/3rdparty/threadweaver/src/job.cpp
deleted file mode 100644
index 1068ec7fe..000000000
--- a/src/3rdparty/threadweaver/src/job.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the Job class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: Job.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "job.h"
-
-#include <QtCore/QList>
-#include <QtCore/QMutex>
-#include "debuggingaids.h"
-#include "thread.h"
-#include <QAtomicPointer>
-#include <QAtomicInt>
-
-#include "queuepolicy.h"
-#include "dependencypolicy.h"
-#include "executor_p.h"
-#include "executewrapper_p.h"
-#include "managedjobpointer.h"
-#include "exception.h"
-
-namespace
-{
-
-class DefaultExecutor : public ThreadWeaver::Executor
-{
-public:
- void begin(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *thread)
- {
- defaultBegin(job, thread);
- }
-
- void execute(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *thread) Q_DECL_OVERRIDE {
- run(job, thread);
- }
-
- void end(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *thread)
- {
- defaultEnd(job, thread);
- }
-};
-
-class DebugExecuteWrapper : public ThreadWeaver::ExecuteWrapper
-{
-public:
- void execute(ThreadWeaver::JobPointer job, ThreadWeaver::Thread *th) Q_DECL_OVERRIDE {
- Q_ASSERT_X(job, Q_FUNC_INFO, "job may not be zero!");
- ThreadWeaver::debug(3, "DefaultExecuteWrapper::execute: executing job %p in thread %i.\n", job.data(), th ? th->id() : 0);
- executeWrapped(job, th);
- ThreadWeaver::debug(3, "Job::execute: finished execution of job in thread %i.\n", th ? th->id() : 0);
- }
-};
-
-static DefaultExecutor defaultExecutor;
-}
-
-namespace ThreadWeaver
-{
-
-class Job::Private
-{
-public:
- Private()
- : mutex(QMutex::NonRecursive)
- , status(Job::Status_NoStatus)
- , executor(&defaultExecutor)
- {}
-
- ~Private()
- {}
-
- /* The list of QueuePolicies assigned to this Job. */
- QList<QueuePolicy *> queuePolicies;
-
- mutable QMutex mutex;
- /* @brief The status of the Job. */
- QAtomicInt status;
-
- /** The Executor that will execute this Job. */
- QAtomicPointer<Executor> executor;
-
- //FIXME What is the correct KDE frameworks no debug switch?
-#if !defined(NDEBUG)
- /** DebugExecuteWrapper for logging of Job execution. */
- DebugExecuteWrapper debugExecuteWrapper;
-#endif
-};
-
-Job::Job()
- : d(new Private())
-{
-#if !defined(NDEBUG)
- d->debugExecuteWrapper.wrap(setExecutor(&d->debugExecuteWrapper));
-#endif
- d->status.storeRelease(Status_New);
-}
-
-Job::~Job()
-{
- for (int index = 0; index < d->queuePolicies.size(); ++index) {
- d->queuePolicies.at(index)->destructed(this);
- }
- delete d;
-}
-
-void Job::execute(JobPointer self, Thread *th)
-{
- Executor *executor = d->executor.loadAcquire();
- Q_ASSERT(executor); //may never be unset!
- Q_ASSERT(self);
- executor->begin(self, th);
- self->setStatus(Status_Running);
- try {
- executor->execute(self, th);
- if (self->status() == Status_Running) {
- self->setStatus(Status_Success);
- }
- } catch (JobAborted &) {
- self->setStatus(Status_Aborted);
- } catch (JobFailed &) {
- self->setStatus(Status_Failed);
- } catch (...) {
- debug(0, "Uncaught exception in Job %p, aborting.", self.data());
- throw;
- }
- Q_ASSERT(self->status() > Status_Running);
- executor->end(self, th);
- executor->cleanup(self, th);
-}
-
-void Job::blockingExecute()
-{
- execute(ManagedJobPointer<Job>(this), 0);
-}
-Executor *Job::setExecutor(Executor *executor)
-{
- return d->executor.fetchAndStoreOrdered(executor == 0 ? &defaultExecutor : executor);
-}
-
-Executor *Job::executor() const
-{
- return d->executor.fetchAndAddOrdered(0);
-}
-
-int Job::priority() const
-{
- return 0;
-}
-
-void Job::setStatus(JobInterface::Status status)
-{
- d->status.storeRelease(status);
-}
-
-JobInterface::Status Job::status() const
-{
- // since status is set only through setStatus, this should be safe:
- return static_cast<Status>(d->status.loadAcquire());
-}
-
-bool Job::success() const
-{
- return d->status.loadAcquire() == Status_Success;
-}
-
-void Job::freeQueuePolicyResources(JobPointer job)
-{
- for (int index = 0; index < d->queuePolicies.size(); ++index) {
- d->queuePolicies.at(index)->free(job);
- }
-}
-
-void Job::defaultBegin(JobPointer, Thread *)
-{
-}
-
-void Job::defaultEnd(JobPointer job, Thread *)
-{
- freeQueuePolicyResources(job);
-}
-
-void Job::aboutToBeQueued(QueueAPI *api)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- aboutToBeQueued_locked(api);
-}
-
-void Job::aboutToBeQueued_locked(QueueAPI *)
-{
-}
-
-void Job::aboutToBeDequeued(QueueAPI *api)
-{
- QMutexLocker l(mutex()); Q_UNUSED(l);
- aboutToBeDequeued_locked(api);
-}
-
-void Job::aboutToBeDequeued_locked(QueueAPI *)
-{
-}
-
-void Job::assignQueuePolicy(QueuePolicy *policy)
-{
- if (! d->queuePolicies.contains(policy)) {
- d->queuePolicies.append(policy);
- }
-}
-
-void Job::removeQueuePolicy(QueuePolicy *policy)
-{
- int index = d->queuePolicies.indexOf(policy);
- if (index != -1) {
- d->queuePolicies.removeAt(index);
- }
-}
-
-QList<QueuePolicy *> Job::queuePolicies() const
-{
- return d->queuePolicies;
-}
-
-bool Job::isFinished() const
-{
- const Status s = status();
- return s == Status_Success || s == Status_Failed || s == Status_Aborted;
-}
-
-QMutex *Job::mutex() const
-{
- return &d->mutex;
-}
-
-}
-
-#include "managedjobpointer.h"
diff --git a/src/3rdparty/threadweaver/src/job.h b/src/3rdparty/threadweaver/src/job.h
deleted file mode 100644
index 3a50af580..000000000
--- a/src/3rdparty/threadweaver/src/job.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- C++ -*-
-
-This file declares the Job class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: Job.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef THREADWEAVER_JOB_H
-#define THREADWEAVER_JOB_H
-
-#include "threadweaver_export.h"
-#include "jobinterface.h"
-#include "jobpointer.h"
-
-QT_BEGIN_NAMESPACE
-class QMutex;
-class QWaitCondition;
-QT_END_NAMESPACE
-
-namespace ThreadWeaver
-{
-
-class Thread;
-class QueuePolicy;
-class QueueAPI;
-class Executor;
-
-/** @brief A Job is a simple abstraction of an action that is to be executed in a thread context.
- *
- * It is essential for the ThreadWeaver library that as a kind of convention, the different creators of Job objects do not touch
- * the protected data members of the Job until somehow notified by the Job.
- *
- * Jobs may not be executed twice. Create two different objects to perform two consecutive or parallel runs.
- * (Note: this rule is being reconsidered.)
- *
- * Jobs may declare dependencies. If Job B depends on Job A, B may not be executed before A is finished. To learn about
- * dependencies, see DependencyPolicy.
- *
- * Job objects do not inherit QObject. To connect to signals when jobs are started or finished, see QObjectDecorator.
- */
-class THREADWEAVER_EXPORT Job : public JobInterface
-{
-public:
- /** Construct a Job. */
- Job();
-
- /** Destructor. */
- virtual ~Job();
-
- /** Perform the job. The thread in which this job is executed is given as a parameter.
- *
- * Do not overload this method to create your own Job implementation, overload run().
- * Whenever the currently executed job is communicated to the outside world, use the supplied job pointer
- * to keep the reference count correct.
- *
- * job is the Job that the queue is executing. It is not necessarily equal to this. For example, Jobs that are
- * decorated expose the decorator's address, not the address of the decorated object.
- */
- virtual void execute(JobPointer job, Thread *) Q_DECL_OVERRIDE;
-
- /** Perform the job synchroneously in the current thread. */
- void blockingExecute() Q_DECL_OVERRIDE;
-
- /** Set the Executor object that is supposed to run the job.
- *
- * Returns the previously set executor. The executor can never be unset. If zero is passed in as the new executor, the Job
- * will internally reset to a default executor that only invokes run().
- */
- Executor *setExecutor(Executor *executor) Q_DECL_OVERRIDE;
-
- /** Returns the executor currently set on the Job. */
- Executor *executor() const Q_DECL_OVERRIDE;
-
- /** The queueing priority of the job.
- * Jobs will be sorted by their queueing priority when enqueued. A higher queueing priority will place the job in front of all
- * lower-priority jobs in the queue.
- *
- * Note: A higher or lower priority does not influence queue policies. For example, a high-priority job that has an unresolved
- * dependency will not be executed, which means an available lower-priority job will take precedence.
- *
- * The default implementation returns zero. Only if this method is overloaded for some job classes, priorities will influence
- * the execution order of jobs. */
- int priority() const Q_DECL_OVERRIDE;
-
- /** @brief Set the status of the Job.
- *
- * Do not call this method unless you know what you are doing, please :-) */
- void setStatus(Status) Q_DECL_OVERRIDE;
-
- /** @brief The status of the job.
- *
- * The status will be changed to Status_Success if the run() method exits normally.
- */
- Status status() const Q_DECL_OVERRIDE;
-
- /** Return whether the Job finished successfully or not.
- * The default implementation simply returns true. Overload in derived classes if the derived Job class can fail.
- *
- * If a job fails (success() returns false), it will *NOT* resolve its dependencies when it finishes. This will make sure that
- * Jobs that depend on the failed job will not be started.
- *
- * There is an important gotcha: When a Job object it deleted, it will always resolve its dependencies. If dependent jobs should
- * not be executed after a failure, it is important to dequeue those before deleting the failed Job. A Sequence may be
- * helpful for that purpose.
- */
- bool success() const Q_DECL_OVERRIDE;
-
- /** Abort the execution of the job.
- *
- * Call this method to ask the Job to abort if it is currently executed. Please note that the default implementation of
- * the method does nothing (!). This is due to the fact that there is no generic method to abort a processing Job. Not even a
- * default boolean flag makes sense, as Job could, for example, be in an event loop and will need to create an exit event. You
- * have to reimplement the method to actually initiate an abort action.
- *
- * The method is not pure virtual because users are not supposed to be forced to always implement requestAbort(). Also, this
- * method is supposed to return immediately, not after the abort has completed. It requests the abort, the Job has to act on
- * the request. */
- void requestAbort() Q_DECL_OVERRIDE {}
-
- /** The job is about to be added to the weaver's job queue.
- *
- * The job will be added right after this method finished. The default implementation does nothing. Use this method to, for
- * example, queue sub-operations as jobs before the job itself is queued.
- *
- * Note: When this method is called, the associated Weaver object's thread holds a lock on the weaver's queue. Therefore, it
- * is save to assume that recursive queueing is atomic from the queues perspective.
- *
- * @param api the QueueAPI object the job will be queued in */
- void aboutToBeQueued(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Called from aboutToBeQueued() while the mutex is being held. */
- void aboutToBeQueued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** This Job is about the be dequeued from the weaver's job queue.
- *
- * The job will be removed from the queue right after this method returns. Use this method to dequeue, if necessary,
- * sub-operations (jobs) that this job has enqueued.
- *
- * Note: When this method is called, the associated Weaver object's thread does hold a lock on the weaver's queue.
- * Note: The default implementation does nothing.
- *
- * @param weaver the Weaver object from which the job will be dequeued */
- void aboutToBeDequeued(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Called from aboutToBeDequeued() while the mutex is being held. */
- void aboutToBeDequeued_locked(QueueAPI *api) Q_DECL_OVERRIDE;
-
- /** Returns true if the jobs's execute method finished. */
- bool isFinished() const Q_DECL_OVERRIDE;
-
- /** Assign a queue policy.
- *
- * Queue Policies customize the queueing (running) behaviour of sets of jobs. Examples for queue policies are dependencies
- * and resource restrictions. Every queue policy object can only be assigned once to a job, multiple assignments will be
- * IGNORED. */
- void assignQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
-
- /** Remove a queue policy from this job. */
- void removeQueuePolicy(QueuePolicy *) Q_DECL_OVERRIDE;
-
- /** @brief Return the queue policies assigned to this Job. */
- QList<QueuePolicy *> queuePolicies() const;
-
-private:
- class Private;
- Private *d;
-
-protected:
- /** Free the queue policies acquired before this job has been executed. */
- void freeQueuePolicyResources(JobPointer) Q_DECL_OVERRIDE;
-
- friend class Executor;
- /** The method that actually performs the job.
- *
- * It is called from execute(). This method is the one to overload it with the job's task.
- *
- * The Job will be executed in the specified thread. thread may be zero, indicating that the job is being executed some
- * other way (for example, synchroneously by some other job). self specifies the job as the queue sees it. Whenever publishing
- * information about the job to the outside world, for example by emitting signals, use self, not this. self is the reference
- * counted object handled by the queue. Using it as signal parameters will amongst other things prevent thejob from being
- * memory managed and deleted.
- */
- virtual void run(JobPointer self, Thread *thread) = 0;
-
- /** @brief Perform standard tasks before starting the execution of a job.
- *
- * The default implementation is empty.
- * job is the Job that the queue is executing. It is not necessarily equal to this. For example, Jobs that are
- * decorated expose the decorator's address, not the address of the decorated object. */
- void defaultBegin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-
- /** @brief Perform standard task after the execution of a job.
- *
- * The default implementation is empty.
- * job is the Job that the queue is executing. It is not necessarily equal to this. For example, Jobs that are
- * decorated expose the decorator's address, not the address of the decorated object. */
- void defaultEnd(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-
- /** The mutex used to protect this job. */
- QMutex *mutex() const Q_DECL_OVERRIDE;
-
-};
-
-}
-
-#endif // THREADWEAVER_JOB_H
diff --git a/src/3rdparty/threadweaver/src/jobinterface.h b/src/3rdparty/threadweaver/src/jobinterface.h
deleted file mode 100644
index 2a78182d0..000000000
--- a/src/3rdparty/threadweaver/src/jobinterface.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- C++ -*-
-
- Interface for jobs in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef JOBINTERFACE_H
-#define JOBINTERFACE_H
-
-#include <QSharedPointer>
-
-#include "threadweaver_export.h"
-#include "jobpointer.h"
-
-QT_BEGIN_NAMESPACE
-class QMutex;
-QT_END_NAMESPACE
-
-namespace ThreadWeaver
-{
-
-class Thread;
-class Executor;
-class QueueAPI;
-class QueuePolicy;
-
-class JobInterface;
-typedef QSharedPointer<JobInterface> JobPointer;
-
-class THREADWEAVER_EXPORT JobInterface
-{
-public:
- enum Status {
- Status_NoStatus = 0,
- Status_New,
- Status_Queued,
- Status_Running,
- Status_Success,
- Status_Failed,
- Status_Aborted,
- Status_NumberOfStatuses,
- };
-
- virtual ~JobInterface() {}
- virtual void execute(JobPointer job, Thread *) = 0;
- virtual void blockingExecute() = 0;
- virtual Executor *setExecutor(Executor *executor) = 0;
- virtual Executor *executor() const = 0;
- virtual int priority() const = 0;
- virtual Status status() const = 0;
- virtual void setStatus(Status) = 0;
- virtual bool success() const = 0;
- virtual void requestAbort() = 0;
- virtual void aboutToBeQueued(QueueAPI *api) = 0;
- virtual void aboutToBeQueued_locked(QueueAPI *api) = 0;
- virtual void aboutToBeDequeued(QueueAPI *api) = 0;
- virtual void aboutToBeDequeued_locked(QueueAPI *api) = 0;
- virtual bool isFinished() const = 0;
- virtual void assignQueuePolicy(QueuePolicy *) = 0;
- virtual void removeQueuePolicy(QueuePolicy *) = 0;
- virtual QList<QueuePolicy *> queuePolicies() const = 0;
- virtual void freeQueuePolicyResources(JobPointer) = 0;
- virtual void run(JobPointer self, Thread *thread) = 0;
- friend class Executor;
- virtual void defaultBegin(JobPointer job, Thread *thread) = 0;
- virtual void defaultEnd(JobPointer job, Thread *thread) = 0;
- virtual QMutex *mutex() const = 0;
-};
-
-}
-
-Q_DECLARE_METATYPE(ThreadWeaver::JobPointer)
-
-#endif // JOBINTERFACE_H
diff --git a/src/3rdparty/threadweaver/src/jobpointer.h b/src/3rdparty/threadweaver/src/jobpointer.h
deleted file mode 100644
index 91093dc69..000000000
--- a/src/3rdparty/threadweaver/src/jobpointer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- C++ -*-
-
- Shared pointer based jobs in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef THREADWEAVER_JOBPOINTER_H
-#define THREADWEAVER_JOBPOINTER_H
-
-// JobPointer is declared together with JobInterface
-#include "jobinterface.h"
-
-#endif // THREADWEAVER_JOBPOINTER_H
diff --git a/src/3rdparty/threadweaver/src/lambda.h b/src/3rdparty/threadweaver/src/lambda.h
deleted file mode 100644
index 092ffc1bf..000000000
--- a/src/3rdparty/threadweaver/src/lambda.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- Wrap functors in jobs in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef LAMBDA_H
-#define LAMBDA_H
-
-#include "job.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief Lambda is a template that takes any type on which operator() is available, and executes it in run(). */
-template <typename T>
-class Lambda : public Job
-{
-public:
- explicit Lambda(T t_)
- : t(t_)
- {}
-
-protected:
- void run(JobPointer, Thread *) Q_DECL_FINAL {
- t();
- }
-
-private:
- T t;
-};
-
-}
-
-#endif // LAMBDA_H
diff --git a/src/3rdparty/threadweaver/src/managedjobpointer.h b/src/3rdparty/threadweaver/src/managedjobpointer.h
deleted file mode 100644
index c42006e52..000000000
--- a/src/3rdparty/threadweaver/src/managedjobpointer.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- C++ -*-
-
- Shared pointer based jobs that are managed by the caller in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef MANAGEDJOBPOINTER_H
-#define MANAGEDJOBPOINTER_H
-
-#include <QSharedPointer>
-
-#include "jobinterface.h"
-
-namespace ThreadWeaver
-{
-
-inline void doNotDeleteJob(JobInterface *) {}
-
-template<typename T>
-class ManagedJobPointer : public QSharedPointer<T>
-{
-public:
- ManagedJobPointer(T *job)
- : QSharedPointer<T>(job, doNotDeleteJob) {}
-};
-
-}
-
-#endif // MANAGEDJOBPOINTER_H
diff --git a/src/3rdparty/threadweaver/src/qobjectdecorator.cpp b/src/3rdparty/threadweaver/src/qobjectdecorator.cpp
deleted file mode 100644
index 44118277d..000000000
--- a/src/3rdparty/threadweaver/src/qobjectdecorator.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
- A decorator to make jobs into QObjects in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "qobjectdecorator.h"
-#include "collection.h"
-#include "sequence.h"
-#include "managedjobpointer.h"
-
-namespace ThreadWeaver
-{
-
-QObjectDecorator::QObjectDecorator(JobInterface *decoratee, QObject *parent)
- : QObject(parent)
- , IdDecorator(decoratee)
-{
-}
-
-QObjectDecorator::QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent)
- : QObject(parent)
- , IdDecorator(decoratee, autoDelete)
-{
-}
-
-void QObjectDecorator::defaultBegin(JobPointer self, Thread *thread)
-{
- Q_ASSERT(job());
- Q_EMIT started(self);
- job()->defaultBegin(self, thread);
-}
-
-void QObjectDecorator::defaultEnd(JobPointer self, Thread *thread)
-{
- Q_ASSERT(job());
- job()->defaultEnd(self, thread);
- if (!self->success()) {
- Q_EMIT failed(self);
- }
- Q_EMIT done(self);
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/qobjectdecorator.h b/src/3rdparty/threadweaver/src/qobjectdecorator.h
deleted file mode 100644
index d8a8a11b9..000000000
--- a/src/3rdparty/threadweaver/src/qobjectdecorator.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- C++ -*-
-
- A decorator to make jobs into QObjects in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef THREADWEAVER_QOBJECTDECORATOR_H
-#define THREADWEAVER_QOBJECTDECORATOR_H
-
-#include <QtCore/QObject>
-
-#include "threadweaver_export.h"
-#include "iddecorator.h"
-
-namespace ThreadWeaver
-{
-
-class Collection;
-class Sequence;
-
-class THREADWEAVER_EXPORT QObjectDecorator : public QObject, public IdDecorator
-{
- Q_OBJECT
-public:
- explicit QObjectDecorator(JobInterface *decoratee, QObject *parent = 0);
- explicit QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent = 0);
-
-Q_SIGNALS:
- /** This signal is emitted when this job is being processed by a thread. */
- void started(ThreadWeaver::JobPointer);
- /** This signal is emitted when the job has been finished (no matter if it succeeded or not). */
- void done(ThreadWeaver::JobPointer);
- /** This job has failed.
- *
- * This signal is emitted when success() returns false after the job is executed. */
- void failed(ThreadWeaver::JobPointer);
-
-protected:
- void defaultBegin(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void defaultEnd(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
-};
-
-typedef QSharedPointer<QObjectDecorator> QJobPointer;
-
-}
-
-#endif // THREADWEAVER_QOBJECTDECORATOR_H
diff --git a/src/3rdparty/threadweaver/src/queue.cpp b/src/3rdparty/threadweaver/src/queue.cpp
deleted file mode 100644
index fb71b8126..000000000
--- a/src/3rdparty/threadweaver/src/queue.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/* -*- C++ -*-
-
- The Queue class in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QMutex>
-#include <QtCore/QVector>
-
-#include "queue.h"
-#include "weaver_p.h"
-
-using namespace ThreadWeaver;
-
-namespace
-{
-static Queue::GlobalQueueFactory *globalQueueFactory;
-}
-
-class Queue::Private
-{
-public:
- Private(Queue *q, QueueSignals *queue)
- : implementation(queue)
- {
- Q_ASSERT_X(qApp != 0, Q_FUNC_INFO, "Cannot create global ThreadWeaver instance before QApplication!");
- Q_ASSERT(queue);
- queue->setParent(q);
- q->connect(implementation, SIGNAL(finished()), SIGNAL(finished()));
- q->connect(implementation, SIGNAL(suspended()), SIGNAL(suspended()));
- q->connect(implementation, SIGNAL(jobDone(ThreadWeaver::JobPointer)), SIGNAL(jobDone(ThreadWeaver::JobPointer)));
- }
-
- QueueSignals *implementation;
- void init(QueueSignals *implementation);
-};
-
-/** @brief Construct a Queue. */
-Queue::Queue(QObject *parent)
- : QueueSignals(parent)
- , d(new Private(this, new Weaver))
-{
-}
-
-/** @brief Construct a Queue, specifying the QueueSignals implementation to use.
- *
- * The QueueSignals instance is usually a Weaver object, which may be customized for specific
- * application needs. The Weaver instance will take ownership of the implementation object and
- * deletes it when destructed.
- * @see Weaver
- * @see GlobalQueueFactory
- */
-Queue::Queue(QueueSignals *implementation, QObject *parent)
- : QueueSignals(parent)
- , d(new Private(this, implementation))
-{
-}
-
-/** @brief Destruct the Queue object.
- *
- * If the queue is not already in Destructed state, the destructor will call shutDown() to make sure
- * enqueued jobs are completed and the queue is idle.
- * The queue implementation will be destroyed.
- * @see shutDown()
- * @see ThreadWeaver::Destructed
- */
-Queue::~Queue()
-{
- if (d->implementation->state()->stateId() != Destructed) {
- d->implementation->shutDown();
- }
- delete d->implementation;
- delete d;
-}
-
-/** @brief Create a QueueStream to enqueue jobs into this queue. */
-QueueStream Queue::stream()
-{
- return QueueStream(this);
-}
-
-void Queue::shutDown()
-{
- d->implementation->shutDown();
-}
-
-/** @brief Set the factory object that will create the global queue.
- *
- * Once set, the global queue factory will be deleted when the global ThreadWeaver pool is deleted.
- * The factory object needs to be set before the global ThreadWeaver pool is instantiated. Call this
- * method before Q(Core)Application is constructed. */
-void Queue::setGlobalQueueFactory(Queue::GlobalQueueFactory *factory)
-{
- if (globalQueueFactory) {
- delete globalQueueFactory;
- }
- globalQueueFactory = factory;
-}
-
-const State *Queue::state() const
-{
- return d->implementation->state();
-}
-
-namespace
-{
-
-class StaticThreadWeaverInstanceGuard : public QObject
-{
- Q_OBJECT
-public:
- explicit StaticThreadWeaverInstanceGuard(QAtomicPointer<Queue> &instance, QCoreApplication *app)
- : QObject(app)
- , instance_(instance)
- {
- Q_ASSERT_X(app != 0, Q_FUNC_INFO, "Calling ThreadWeaver::Weaver::instance() requires a QCoreApplication!");
- QObject *impl = instance.load()->findChild<QueueSignals*>();
- Q_ASSERT(impl);
- impl->setObjectName(QStringLiteral("GlobalQueue"));
- qAddPostRoutine(shutDownGlobalQueue);
- }
-
- ~StaticThreadWeaverInstanceGuard()
- {
- instance_.fetchAndStoreOrdered(0);
- delete globalQueueFactory;
- globalQueueFactory = 0;
- }
-private:
- static void shutDownGlobalQueue()
- {
- Queue::instance()->shutDown();
- Q_ASSERT(Queue::instance()->state()->stateId() == Destructed);
- }
-
- QAtomicPointer<Queue> &instance_;
-};
-
-}
-
-/** @brief Access the application-global Queue.
- *
- * In some cases, the global queue is sufficient for the applications purpose. The global queue will only be
- * created if this method is actually called in the lifetime of the application.
- *
- * The Q(Core)Application object must exist when instance() is called for the first time.
- * The global queue will be destroyed when Q(Core)Application is destructed. After that, the instance() method
- * returns zero.
- */
-Queue *Queue::instance()
-{
- static QAtomicPointer<Queue> s_instance(globalQueueFactory
- ? globalQueueFactory->create(qApp)
- : new Queue(qApp));
- //Order is of importance here:
- //When s_instanceGuard is destructed (first, before s_instance), it sets the value of s_instance to zero. Next, qApp will delete
- //the object s_instance pointed to.
- static StaticThreadWeaverInstanceGuard *s_instanceGuard = new StaticThreadWeaverInstanceGuard(s_instance, qApp);
- Q_UNUSED(s_instanceGuard);
- Q_ASSERT_X(s_instance.load() == 0 || s_instance.load()->thread() == QCoreApplication::instance()->thread(),
- Q_FUNC_INFO,
- "The global ThreadWeaver queue needs to be instantiated (accessed first) from the main thread!");
- return s_instance.loadAcquire();
-}
-
-void Queue::enqueue(const QVector<JobPointer> &jobs)
-{
- d->implementation->enqueue(jobs);
-}
-
-void Queue::enqueue(const JobPointer &job)
-{
- enqueue(QVector<JobPointer>() << job);
-}
-
-bool Queue::dequeue(const JobPointer &job)
-{
- return d->implementation->dequeue(job);
-}
-
-void Queue::dequeue()
-{
- return d->implementation->dequeue();
-}
-
-void Queue::finish()
-{
- return d->implementation->finish();
-}
-
-void Queue::suspend()
-{
- return d->implementation->suspend();
-}
-
-void Queue::resume()
-{
- return d->implementation->resume();
-}
-
-bool Queue::isEmpty() const
-{
- return d->implementation->isEmpty();
-}
-
-bool Queue::isIdle() const
-{
- return d->implementation->isIdle();
-}
-
-int Queue::queueLength() const
-{
- return d->implementation->queueLength();
-}
-
-void Queue::setMaximumNumberOfThreads(int cap)
-{
- d->implementation->setMaximumNumberOfThreads(cap);
-}
-
-int Queue::currentNumberOfThreads() const
-{
- return d->implementation->currentNumberOfThreads();
-}
-
-int Queue::maximumNumberOfThreads() const
-{
- return d->implementation->maximumNumberOfThreads();
-}
-
-void Queue::requestAbort()
-{
- d->implementation->requestAbort();
-}
-
-void Queue::reschedule()
-{
- d->implementation->reschedule();
-}
-
-#include "queue.moc"
diff --git a/src/3rdparty/threadweaver/src/queue.h b/src/3rdparty/threadweaver/src/queue.h
deleted file mode 100644
index 43ad21117..000000000
--- a/src/3rdparty/threadweaver/src/queue.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- C++ -*-
-
- The Queue class in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUE_H
-#define THREADWEAVER_QUEUE_H
-
-#include <QtCore/QObject>
-
-#include "queuesignals.h"
-#include "queuestream.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class State;
-
-/** @brief Queue implements a ThreadWeaver job queue.
- *
- * Queues process jobs enqueued in them by automatically assigning them to worker threads they manage.
- * Applications using ThreadWeaver can make use of a global Queue which is instantiated on demand, or
- * create multiple queues as needed. A job assigned to a queue will be processed by that specific queue.
- *
- * Worker threads are created by the queues as needed. To create a customized global queue,
- * see GlobalQueueFactory.
- *
- * @see GlobalQueueFactory
- * @see Queue::enqueue()
- * @see Queue::instance()
- */
-class THREADWEAVER_EXPORT Queue : public QueueSignals
-{
- Q_OBJECT
-public:
- explicit Queue(QObject *parent = 0);
- explicit Queue(QueueSignals *implementation, QObject *parent = 0);
- virtual ~Queue();
-
- QueueStream stream();
-
- const State *state() const;
-
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
-
- static ThreadWeaver::Queue *instance();
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE;
- void enqueue(const JobPointer &job);
- bool dequeue(const JobPointer &) Q_DECL_OVERRIDE;
- void dequeue() Q_DECL_OVERRIDE;
- void finish() Q_DECL_OVERRIDE;
- void suspend() Q_DECL_OVERRIDE;
- void resume() Q_DECL_OVERRIDE;
- bool isEmpty() const Q_DECL_OVERRIDE;
- bool isIdle() const Q_DECL_OVERRIDE;
- int queueLength() const Q_DECL_OVERRIDE;
- void requestAbort() Q_DECL_OVERRIDE;
- void reschedule() Q_DECL_OVERRIDE;
- void shutDown() Q_DECL_OVERRIDE;
-
- /** @brief Interface for the global queue factory. */
- struct GlobalQueueFactory {
- virtual ~GlobalQueueFactory() {}
- virtual Queue *create(QObject *parent) = 0;
-
- };
- static void setGlobalQueueFactory(GlobalQueueFactory *factory);
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif // THREADWEAVER_QUEUE_H
diff --git a/src/3rdparty/threadweaver/src/queueapi.cpp b/src/3rdparty/threadweaver/src/queueapi.cpp
deleted file mode 100644
index f38a11142..000000000
--- a/src/3rdparty/threadweaver/src/queueapi.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- C++ -*-
-
- The detailed API for Weavers in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "queueapi_p.h"
-
-namespace ThreadWeaver
-{
-
-QueueAPI::QueueAPI(QObject *parent) :
- QueueSignals(parent)
-{
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/queueapi_p.h b/src/3rdparty/threadweaver/src/queueapi_p.h
deleted file mode 100644
index 5e0813568..000000000
--- a/src/3rdparty/threadweaver/src/queueapi_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
- The detailed API for Weavers in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef QUEUEAPI_H
-#define QUEUEAPI_H
-
-#include "queuesignals.h"
-#include "weaverinterface_p.h"
-#include "state.h"
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class QueueAPI : public QueueSignals, public WeaverInterface
-{
- Q_OBJECT
-
-public:
- explicit QueueAPI(QObject *parent = 0);
-
- virtual void shutDown_p() = 0;
- virtual const State *state() const = 0;
- virtual State *state() = 0;
- virtual void setMaximumNumberOfThreads_p(int cap) = 0;
- virtual int maximumNumberOfThreads_p() const = 0;
- virtual int currentNumberOfThreads_p() const = 0;
- virtual bool dequeue_p(JobPointer) = 0;
- virtual void dequeue_p() = 0;
- virtual void finish_p() = 0;
- virtual void suspend_p() = 0;
- virtual void resume_p() = 0;
- virtual bool isEmpty_p() const = 0;
- virtual bool isIdle_p() const = 0;
- virtual int queueLength_p() const = 0;
- virtual void requestAbort_p() = 0;
-};
-
-}
-
-#endif // QUEUEAPI_H
diff --git a/src/3rdparty/threadweaver/src/queueing.h b/src/3rdparty/threadweaver/src/queueing.h
deleted file mode 100644
index 84ee40211..000000000
--- a/src/3rdparty/threadweaver/src/queueing.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUEING_H
-#define THREADWEAVER_QUEUEING_H
-
-#include "jobpointer.h"
-#include "managedjobpointer.h"
-#include "jobinterface.h"
-#include "collection.h"
-#include "lambda.h"
-#include "qobjectdecorator.h"
-#include "queue.h"
-
-namespace ThreadWeaver
-{
-
-// make a job that calls a functor, anything that responds to operator()
-template<typename T>
-QSharedPointer<Lambda<T> > make_job(T t)
-{
- QSharedPointer<Lambda<T> > ret(new Lambda<T>(t));
- return ret;
-}
-
-// make a job pointer holding a pointer to a Job(Interface)
-template<typename T>
-inline QSharedPointer<T> make_job(T *job)
-{
- JobInterface *test = static_cast<JobInterface *>(job); Q_UNUSED(test);
- return QSharedPointer<T>(job);
-}
-
-// make a job pointer holding anything resembling JobInterface
-inline JobPointer make_job_raw(JobInterface *job)
-{
- return ManagedJobPointer<JobInterface>(job);
-}
-
-// enqueue any functor type to the specified queue:
-template<typename T>
-JobPointer enqueue(Queue *weaver, T t)
-{
- JobPointer ret = make_job(t);
- weaver->enqueue(ret);
- return ret;
-}
-
-template<typename T>
-QSharedPointer<T> enqueue(Queue *weaver, T *t)
-{
- JobInterface *test = static_cast<JobInterface *>(t); Q_UNUSED(test);
- QSharedPointer<T> ret(make_job(t));
- weaver->enqueue(ret);
- return ret;
-}
-
-// specialise for JobPointer:
-template<>
-inline JobPointer enqueue<JobPointer>(Queue *weaver, JobPointer job)
-{
- weaver->enqueue(job);
- return job;
-}
-
-// convenience overload: enqueue the functor to the global queue:
-template<typename T>
-JobPointer enqueue(T t)
-{
- return enqueue(Queue::instance(), t);
-}
-
-// enqueue a raw pointer with no memory management
-inline JobPointer enqueue_raw(Queue *weaver, JobInterface *job)
-{
- return enqueue(weaver, make_job_raw(job));
-}
-
-// overload to enqueue to the global pool
-inline JobPointer enqueue_raw(JobInterface *job)
-{
- return enqueue(Queue::instance(), make_job_raw(job));
-}
-
-}
-
-#endif // THREADWEAVER_QUEUEING_H
diff --git a/src/3rdparty/threadweaver/src/queueinterface.h b/src/3rdparty/threadweaver/src/queueinterface.h
deleted file mode 100644
index 04e39e929..000000000
--- a/src/3rdparty/threadweaver/src/queueinterface.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the QueueInterface class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef WeaverInterface_H
-#define WeaverInterface_H
-
-#include <QtCore/QObject>
-#include <QVector>
-
-#include "threadweaver_export.h"
-#include "jobpointer.h"
-#include "jobinterface.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class State;
-class WeaverObserver;
-
-/** WeaverInterface provides a common interface for weaver implementations.
-
-In most cases, it is sufficient for an application to hold exactly one
-ThreadWeaver job queue. To execute jobs in a specific order, use job
-dependencies. To limit the number of jobs of a certain type that can
-be executed at the same time, use resource restrictions. To handle
-special requirements of the application when it comes to the order of
-execution of jobs, implement a special queue policy and apply it to
-the jobs.
-
-Users of the ThreadWeaver API are encouraged to program to this
-interface, instead of the implementation. This way, implementation
-changes will not affect user programs.
-
-This interface can be used for example to implement adapters and
-decorators. The member documentation is provided in the Weaver and
-WeaverImpl classes.
-*/
-
-class THREADWEAVER_EXPORT QueueInterface
-{
-public:
- virtual ~QueueInterface() {}
- /** Return the state of the weaver object. */
- virtual const State *state() const = 0;
-
- /** Shut down the queue.
- * Tells all threads to exit, and changes to Destructed state.
- * It is safe to destroy the queue once this method returns.
- */
- virtual void shutDown() = 0;
-
- /** Set the maximum number of threads this Weaver object may start. */
- virtual void setMaximumNumberOfThreads(int cap) = 0;
-
- /** Get the maximum number of threads this Weaver may start. */
- virtual int maximumNumberOfThreads() const = 0;
-
- /** Returns the current number of threads in the inventory. */
- virtual int currentNumberOfThreads() const = 0;
-
- /** Queue a vector of jobs.
-
- It depends on the state if execution of the job will be attempted
- immediately. In suspended state, jobs can be added to the queue,
- but the threads remain suspended. In WorkongHard state, an idle
- thread may immediately execute the job, or it might be queued if
- all threads are busy.
-
- JobPointer is a shared pointer. This means the object pointed to will be deleted if this object
- is the last remaining reference to it. Keep a JobPointer to the job to avoid automatic deletion.
- */
- virtual void enqueue(const QVector<JobPointer> &jobs) = 0;
-
- /** Remove a job from the queue.
- *
- * If the job was queued but not started so far, it is removed from the queue.
- *
- * You can always call dequeue, it will return true if the job was dequeued. However if the job is not in the queue anymore,
- * it is already being executed, it is too late to dequeue, and dequeue will return false. The return value is thread-safe - if
- * true is returned, the job was still waiting, and has been dequeued. If not, the job was not waiting in the queue.
- *
- * Modifying queued jobs is best done on a suspended queue. Often, for example at the end of an application, it is sufficient
- * to dequeue all jobs (which leaves only the ones mid-air in threads), call finish (that will wait for all the mid air jobs to
- * complete), and then exit. Without dequeue(), all jobs in the queue would be executed during finish().
- * @see requestAbort for aborting jobs during execution
- * @return true if the job was waiting and has been dequeued
- * @return false if the job was not found waiting in the queue
- */
- virtual bool dequeue(const JobPointer &job) = 0;
-
- /** Remove all queued jobs.
- *
- * All waiting jobs will be dequeued. The semantics are the same as for dequeue(JobInterface).
- *
- * @see dequeue(JobInterface)
- */
- virtual void dequeue() = 0;
- /** Finish all queued operations, then return.
-
- This method is used in imperative (not event driven) programs that
- cannot react on events to have the controlling (main) thread wait
- wait for the jobs to finish. The call will block the calling
- thread and return when all queued jobs have been processed.
-
- Warning: This will suspend your thread!
- Warning: If one of your jobs enters an infinite loop, this
- will never return! */
- virtual void finish() = 0;
- /** Suspend job execution.
- When suspending, all threads are allowed to finish the
- currently assigned job but will not receive a new
- assignment.
- When all threads are done processing the assigned job, the
- signal suspended will() be emitted.
- If you call suspend() and there are no jobs left to
- be done, you will immediately receive the suspended()
- signal. */
- virtual void suspend() = 0;
- /** Resume job queueing.
- @see suspend
- */
- virtual void resume() = 0;
- /** Is the queue empty?
- The queue is empty if no more jobs are queued. */
- virtual bool isEmpty() const = 0;
- /** Is the weaver idle?
- The weaver is idle if no jobs are queued and no jobs are processed
- by the threads. */
- virtual bool isIdle() const = 0;
- /** Returns the number of pending jobs.
- This will return the number of queued jobs. Jobs that are
- currently being executed are not part of the queue. All jobs in
- the queue are waiting to be executed.
- */
- virtual int queueLength() const = 0;
-
- /** Request aborts of the currently executed jobs.
- It is important to understand that aborts are requested, but
- cannot be guaranteed, as not all Job classes support it. It is up
- to the application to decide if and how job aborts are
- necessary. */
- virtual void requestAbort() = 0;
-
- /** @brief Reschedule the jobs in the queue.
- * This method triggers a scheduling attempt to perform jobs. It will schedule enqueued jobs to be executed by idle threads.
- * It should only be necessary to call it if the canRun() status of a job changed spontaneously due to external reasons. */
- virtual void reschedule() = 0;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/queuepolicy.h b/src/3rdparty/threadweaver/src/queuepolicy.h
deleted file mode 100644
index 2848a8086..000000000
--- a/src/3rdparty/threadweaver/src/queuepolicy.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the QueuePolicy class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004, 2005, 2006 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://www.hackerbuero.org $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#ifndef QUEUEPOLICY_H
-#define QUEUEPOLICY_H
-
-#include "jobpointer.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-
-/** @brief QueuePolicy is an interface for customizations of the queueing behaviour of jobs.
- *
- * A job can have a number of queue policies assigned. In that case, the job is only
- * executed when the method canRun() of all assigned policies return true. For every call to
- * canRun() that returns true, it is guaranteed that the method free() or the method release()
- * is called. Calling free() means the job has been executed, while calling release() means
- * the job was not executed for external reasons, and will be tried later on.
- *
- * As an example, dependencies can be implemented using a QueuePolicy: canRun() returns true
- * when the job has no unresolved dependencies. free() and release() are empty.
- *
- * A job can have multiple queue policies assigned, and will only be executed if all of them
- * return true from canRun() within the same execution attempt. Jobs only keep a reference to the
- * QueuePolicy. Therefore, the same policy object can be assigned to multiple jobs and this way
- * control the way all those jobs are exeuted. Jobs never assume ownership of their assigned queue
- * policies.
- */
-class THREADWEAVER_EXPORT QueuePolicy
-{
-public:
- virtual ~QueuePolicy() {}
-
- /** @brief canRun() is called before the job is executed.
- * The job will only be executed if canRun() returns true.
- */
- virtual bool canRun(JobPointer) = 0;
-
- /** @brief free() is called after the job has been executed.
- * It is guaranteed that free is called only after canRun()
- * returned true at an earlier time.
- */
- virtual void free(JobPointer) = 0;
-
- /** @brief release() is called if canRun() returned true, but the job has not been executed for external reasons.
- *
- * For example, a second QueuePolicy could have returned false from canRun() for the same job.
- */
- virtual void release(JobPointer) = 0;
-
- /** @brief destructing() is called when a Job that has this queue policy assigned gets destructed.
- */
- virtual void destructed(JobInterface *job) = 0;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/queuesignals.cpp b/src/3rdparty/threadweaver/src/queuesignals.cpp
deleted file mode 100644
index 7ba4ac44c..000000000
--- a/src/3rdparty/threadweaver/src/queuesignals.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "queuesignals.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief Construct a QueueSignals object, passing the QObject parent. */
-QueueSignals::QueueSignals(QObject *parent)
- : QObject(parent)
-{
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/queuesignals.h b/src/3rdparty/threadweaver/src/queuesignals.h
deleted file mode 100644
index ec111306d..000000000
--- a/src/3rdparty/threadweaver/src/queuesignals.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUESIGNALS_H
-#define THREADWEAVER_QUEUESIGNALS_H
-
-#include <QtCore/QObject>
-#include "queueinterface.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief QueueSignals declares the Qt signals shared by the Queue and Weaver classes. */
-class QueueSignals : public QObject, public QueueInterface
-{
- Q_OBJECT
-public:
- explicit QueueSignals(QObject *parent = 0);
-
-Q_SIGNALS:
- /** @brief Emitted when the Queue has completed all jobs currently queued.
- *
- * The Queue emits finished() when the the job queue is empty, and the last job currently processed by a worker threads was
- * completed. Beware that if multiple jobs are enqueued repeatedly one by one, this signal might be emitted multiple times, because the
- * queued jobs where processed before new ones could be queued. To avoid this, queue all relevant jobs in a single operation,
- * using for example a QueueStream or a Collection.
- */
- void finished();
-
- /** @brief The Queue has been suspended.
- *
- * When the Queue is suspended, worker threads will not be assigned new jobs to process. Jobs waiting in the queue will not be
- * started until processing is resumed. When suspend() is called, the worker threads will continue to process the job currently
- * assigned to them. When the last thread finishes it's current assignment, suspended() is emitted.
- *
- * @see suspend()
- */
- void suspended();
-
- /** @brief A Job has been completed.
- *
- * This signal is emitted when a job is finished by a worker thread.
- */
- void jobDone(ThreadWeaver::JobPointer);
-
- /** @brief Emitted when the processing state of the Queue has changed. */
- void stateChanged(ThreadWeaver::State*);
-};
-
-}
-
-#endif // THREADWEAVER_QUEUESIGNALS_H
diff --git a/src/3rdparty/threadweaver/src/queuestream.cpp b/src/3rdparty/threadweaver/src/queuestream.cpp
deleted file mode 100644
index 735955e6e..000000000
--- a/src/3rdparty/threadweaver/src/queuestream.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include <QVector>
-
-#include "queuestream.h"
-#include "queue.h"
-#include "queueing.h"
-
-namespace ThreadWeaver
-{
-
-class QueueStream::Private
-{
-public:
- Private(Queue *w) : weaver(w) {}
- Queue *weaver;
- QVector<JobPointer> jobs;
-};
-
-QueueStream::QueueStream(Queue *queue)
- : d(new Private(queue))
-{
- Q_ASSERT(queue);
-}
-
-QueueStream::~QueueStream()
-{
- flush();
- delete d;
-}
-
-void ThreadWeaver::QueueStream::add(const ThreadWeaver::JobPointer &job)
-{
- d->jobs.append(job);
-}
-
-void QueueStream::flush()
-{
- if (d->jobs.isEmpty()) {
- return;
- }
- Q_ASSERT(d->weaver);
- d->weaver->enqueue(d->jobs);
- d->jobs.clear();
-}
-
-QueueStream &QueueStream::operator<<(const JobPointer &job)
-{
- add(job);
- return *this;
-}
-
-QueueStream &QueueStream::operator<<(JobInterface *job)
-{
- add(make_job(job));
- return *this;
-}
-
-QueueStream &QueueStream::operator<<(Job &job)
-{
- add(make_job_raw(&job));
- return *this;
-}
-
-/** @brief Return a stream the enqueues jobs in the ThreadWeaver global queue.
- * Using this is synonymous to Weaver::instance()::stream(). */
-QueueStream stream()
-{
- return QueueStream(Queue::instance());
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/queuestream.h b/src/3rdparty/threadweaver/src/queuestream.h
deleted file mode 100644
index e57a1f210..000000000
--- a/src/3rdparty/threadweaver/src/queuestream.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- C++ -*-
-
- This file is part of ThreadWeaver, a KDE framework.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef QUEUESTREAM_H
-#define QUEUESTREAM_H
-
-#include "jobinterface.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-class Queue;
-class Job;
-
-/** @brief QueueStream implements a stream based API to access ThreadWeaver queues. */
-class THREADWEAVER_EXPORT QueueStream
-{
-public:
- explicit QueueStream(Queue *queue);
- ~QueueStream();
- void add(const JobPointer &job);
- void flush();
-
- QueueStream &operator<<(const JobPointer &job);
- QueueStream &operator<<(JobInterface *job);
- //FIXME try with QObjectDecorator (JobInterface&)
- QueueStream &operator<<(Job &job);
-
-private:
- class Private;
- Private *const d;
-};
-
-QueueStream THREADWEAVER_EXPORT stream();
-
-}
-
-#endif // QUEUESTREAM_H
diff --git a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp b/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp
deleted file mode 100644
index bfa21d568..000000000
--- a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the ResourceRestrictionPolicy class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: Job.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#include "resourcerestrictionpolicy.h"
-
-#include <QtCore/QList>
-#include <QtCore/QMutex>
-
-#include "debuggingaids.h"
-#include "managedjobpointer.h"
-
-using namespace ThreadWeaver;
-
-class ResourceRestrictionPolicy::Private
-{
-public:
- Private(int theCap)
- : cap(theCap)
- {}
- QMutex *mutex()
- {
- return &mutex_;
- }
-
- int cap;
- QList<JobPointer> customers;
- QMutex mutex_;
-};
-
-ResourceRestrictionPolicy::ResourceRestrictionPolicy(int cap)
- : QueuePolicy()
- , d(new Private(cap))
-{
-}
-
-ResourceRestrictionPolicy::~ResourceRestrictionPolicy()
-{
- delete d;
-}
-
-void ResourceRestrictionPolicy::setCap(int cap)
-{
- QMutexLocker l(d->mutex());
- d->cap = cap;
-}
-
-int ResourceRestrictionPolicy::cap() const
-{
- QMutexLocker l(d->mutex());
- return d->cap;
-}
-
-bool ResourceRestrictionPolicy::canRun(JobPointer job)
-{
- QMutexLocker l(d->mutex());
- if (d->customers.size() < d->cap) {
- d->customers.append(job);
- return true;
- } else {
- return false;
- }
-}
-
-void ResourceRestrictionPolicy::free(JobPointer job)
-{
- QMutexLocker l(d->mutex());
- int position = d->customers.indexOf(job);
-
- if (position != -1) {
- debug(4, "ResourceRestrictionPolicy::free: job %p done.\n", (void *)job.data());
- d->customers.removeAt(position);
- }
-}
-
-void ResourceRestrictionPolicy::release(JobPointer job)
-{
- free(job);
-}
-
-void ResourceRestrictionPolicy::destructed(JobInterface *job)
-{
- free(ManagedJobPointer<JobInterface>(job));
-}
diff --git a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h b/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h
deleted file mode 100644
index fe54ef5a9..000000000
--- a/src/3rdparty/threadweaver/src/resourcerestrictionpolicy.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- C++ -*-
-
-This file declares the ResourceRestrictionPolicy class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2004-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: Job.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef RESOURCE_RESTRICTION_POLICY_H
-#define RESOURCE_RESTRICTION_POLICY_H
-
-#include <QtGlobal>
-
-#include "jobpointer.h"
-#include "queuepolicy.h"
-
-namespace ThreadWeaver
-{
-
-class JobInterface;
-
-/** @brief ResourceRestrictionPolicy is used to limit the number of concurrent accesses to the same resource.
- *
- * If a set of Jobs accesses a resource that can be overloaded, this may degrade application performance. For
- * example, loading too many files from the hard disc at the same time may lead to longer load times.
- * ResourceRestrictionPolicy can be used to cap the number of accesses. Resource restriction policies are
- * shared between the affected jobs. All jobs that share a resurce restriction policy have to acquire
- * permission from the policy before they can run. In this way, resource restrictions can be compared to
- * semaphores, only that they require no locking at the thread level.
- * The SMIV example uses a resource restriction to limit the number of images files that are loaded from
- * the disk at the same time.
- */
-
-class THREADWEAVER_EXPORT ResourceRestrictionPolicy : public QueuePolicy
-{
-public:
- explicit ResourceRestrictionPolicy(int cap = 0);
- ~ResourceRestrictionPolicy();
-
- /** @brief Cap the number of simultaniously executing jobs.
- * Capping the amount of jobs will make sure that at max the number of jobs executing at any time is
- * limited to the capped amount. Note that immediately after setting the amount of running jobs may be
- * higher than the set amount. This setting only limits the starting of new jobs.
- * @param newCap the new cap to limit the amount of parallel jobs.
- */
- void setCap(int newCap);
- int cap() const;
- bool canRun(JobPointer) Q_DECL_OVERRIDE;
- void free(JobPointer) Q_DECL_OVERRIDE;
- void release(JobPointer) Q_DECL_OVERRIDE;
- void destructed(JobInterface *job) Q_DECL_OVERRIDE;
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif // RESOURCE_RESTRICTION_POLICY_H
diff --git a/src/3rdparty/threadweaver/src/sequence.cpp b/src/3rdparty/threadweaver/src/sequence.cpp
deleted file mode 100644
index d88a47f78..000000000
--- a/src/3rdparty/threadweaver/src/sequence.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the Sequence class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "sequence.h"
-#include "managedjobpointer.h"
-#include "queueapi_p.h"
-#include "debuggingaids.h"
-#include "dependencypolicy.h"
-
-namespace ThreadWeaver
-{
-
-Sequence::Sequence()
- : d(0)
-{
-}
-
-void Sequence::enqueueElements()
-{
- Q_ASSERT(!mutex()->tryLock());
- const int jobs = jobListLength_locked();
- if (jobs > 0) {
- DependencyPolicy::instance().addDependency(jobAt(0), self());
- // set up the dependencies:
- for (int i = 1; i < jobs; ++i) {
- JobPointer jobA = jobAt(i);
- JobPointer jobB = jobAt(i - 1);
- P_ASSERT(jobA != 0);
- P_ASSERT(jobB != 0);
- DependencyPolicy::instance().addDependency(jobA, jobB);
- }
- }
- Collection::enqueueElements();
-}
-
-void Sequence::elementFinished(JobPointer job, Thread *thread)
-{
- REQUIRE(job != 0);
-
- JobPointer s(self());
- Q_ASSERT(!s.isNull());
- Collection::elementFinished(job, thread);
- if (!job->success()) {
- stop(job);
- }
- QMutexLocker l(mutex()); Q_UNUSED(l);
- if (jobListLength_locked() > 0) {
- DependencyPolicy::instance().removeDependency(jobAt(0), s);
- }
-}
-
-}
-
diff --git a/src/3rdparty/threadweaver/src/sequence.h b/src/3rdparty/threadweaver/src/sequence.h
deleted file mode 100644
index 35b2f5607..000000000
--- a/src/3rdparty/threadweaver/src/sequence.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the Sequence class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: DebuggingAids.h 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#ifndef JOBSEQUENCE_H
-#define JOBSEQUENCE_H
-
-#include "collection.h"
-
-namespace ThreadWeaver
-{
-
-/** @brief A Sequence is a vector of Jobs that will be executed in a sequence.
- *
- * It is implemented by automatically creating the necessary dependencies between the Jobs in the sequence.
- *
- * Sequence provides a handy cleanup and unwind mechanism: the stop() slot. If it is called, the processing
- * of the sequence will stop, and all its remaining Jobs will be dequeued.
- * A Sequence is the first element of itself. */
-class THREADWEAVER_EXPORT Sequence : public Collection
-{
-public:
- explicit Sequence();
-
-protected:
- void elementFinished(JobPointer job, Thread *thread) Q_DECL_OVERRIDE;
- void enqueueElements() Q_DECL_OVERRIDE;
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/shuttingdownstate.cpp b/src/3rdparty/threadweaver/src/shuttingdownstate.cpp
deleted file mode 100644
index 361a4abdc..000000000
--- a/src/3rdparty/threadweaver/src/shuttingdownstate.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the ShuttingDownState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: ShuttingDownState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "shuttingdownstate_p.h"
-
-namespace ThreadWeaver
-{
-
-ShuttingDownState::ShuttingDownState(QueueSignals *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void ShuttingDownState::shutDown()
-{
-}
-
-void ShuttingDownState::suspend()
-{
- // ignored: when shutting down, we do not return to the suspended state
-}
-
-void ShuttingDownState::resume()
-{
- // ignored: when shutting down, we do not return from the suspended state
-}
-
-JobPointer ShuttingDownState::applyForWork(Thread *, bool wasBusy)
-{
- Q_UNUSED(wasBusy) // except in Q_ASSERT
- Q_ASSERT(wasBusy == false);
- return JobPointer(); // tell threads to exit
-}
-
-void ShuttingDownState::waitForAvailableJob(Thread *)
-{
- // immidiately return here
-}
-
-StateId ShuttingDownState::stateId() const
-{
- return ShuttingDown;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/shuttingdownstate_p.h b/src/3rdparty/threadweaver/src/shuttingdownstate_p.h
deleted file mode 100644
index a00bb67b0..000000000
--- a/src/3rdparty/threadweaver/src/shuttingdownstate_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the ShuttingDownState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: ShuttingDownState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef ShuttingDownState_H
-#define ShuttingDownState_H
-
-#include "weaverimplstate_p.h"
-
-namespace ThreadWeaver
-{
-
-class Queue;
-
-/** ShuttingDownState is enabled when the Weaver destructor is entered. It
- * prevents threads from still accessing queue management methods, and new jobs being queued.
- */
-class ShuttingDownState : public WeaverImplState
-{
-public:
- explicit ShuttingDownState(QueueSignals *weaver);
-
- /** Shut down the queue. */
- void shutDown() Q_DECL_OVERRIDE;
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** Wait (by suspending the calling thread) until a job becomes available. */
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // ShuttingDownState_H
diff --git a/src/3rdparty/threadweaver/src/state.cpp b/src/3rdparty/threadweaver/src/state.cpp
deleted file mode 100644
index 8642be70c..000000000
--- a/src/3rdparty/threadweaver/src/state.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the state handling in ThreadWeaver.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: State.cpp 20 2005-08-08 21:02:51Z mirko $
-*/
-
-#include "state.h"
-
-#include <QtCore/QString>
-
-namespace ThreadWeaver
-{
-
-const char *StateNames[NoOfStates] = {
- "InConstruction",
- "WorkingHard",
- "Suspending",
- "Suspended",
- "ShuttingDown",
- "Destructed"
-};
-
-class State::Private
-{
-public:
- Private(QueueInterface *theWeaver)
- : weaver(theWeaver)
- {
- Q_ASSERT_X(sizeof StateNames / sizeof StateNames[0] == NoOfStates, "State::Private ctor",
- "Make sure to keep StateId and StateNames in sync!");
- }
-
- /** The Weaver we relate to. */
- QueueInterface *const weaver;
-};
-
-State::State(QueueSignals *weaver)
- : d(new Private(weaver))
-{
-}
-
-State::~State()
-{
- delete d;
-}
-
-QString State::stateName() const
-{
- return QLatin1String(StateNames[stateId()]);
-}
-
-void State::activated()
-{
-}
-
-QueueInterface *State::weaver()
-{
- return d->weaver;
-}
-
-const QueueInterface *State::weaver() const
-{
- return d->weaver;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/state.h b/src/3rdparty/threadweaver/src/state.h
deleted file mode 100644
index 942035a19..000000000
--- a/src/3rdparty/threadweaver/src/state.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the state handling in ThreadWeaver.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: State.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef THREADWEAVER_STATE_H
-#define THREADWEAVER_STATE_H
-
-#include <QString>
-
-#include "queueinterface.h"
-#include "weaverinterface_p.h"
-#include "queuesignals.h"
-#include "threadweaver_export.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-/** All weaver objects maintain a state of operation which can be
- * queried by the application. See the threadweaver documentation on
- * how the different states are related.
- */
-
-enum StateId {
- /** The object is in the state of construction and has not yet
- * started to process jobs. */
- InConstruction = 0,
- /** Jobs are being processed. */
- WorkingHard,
- /** Job processing is suspended, but some jobs which where already
- * in progress are not finished yet. */
- Suspending,
- /** Job processing is suspended, and no jobs are being
- * processed. */
- Suspended,
- /** The object is being destructed. Jobs might still be processed,
- * the destructor will wait for all threads to exit and then
- * end. */
- ShuttingDown,
- /** The object is being destructed, and all threads have
- * exited. No jobs are handled anymore. */
- Destructed,
- /** Not a state, but a sentinel for the number of defined states. */
- NoOfStates
-};
-
-/** We use a State pattern to handle the system state in ThreadWeaver. */
-class THREADWEAVER_EXPORT State : public QueueInterface, public WeaverInterface
-{
-public:
- /** Default constructor. */
- explicit State(QueueSignals *weaver);
-
- /** Destructor. */
- virtual ~State();
-
- /** The ID of the current state.
- * @see StateNames, StateID
- */
- QString stateName() const;
-
- /** The state Id. */
- virtual StateId stateId() const = 0;
-
- /** The state has been changed so that this object is responsible for
- * state handling. */
- virtual void activated();
-
-protected:
- /** The Weaver interface this state handles. */
- virtual QueueInterface *weaver();
- virtual const QueueInterface *weaver() const;
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif // THREADWEAVER_STATE_H
diff --git a/src/3rdparty/threadweaver/src/suspendedstate.cpp b/src/3rdparty/threadweaver/src/suspendedstate.cpp
deleted file mode 100644
index e7cb1e7a6..000000000
--- a/src/3rdparty/threadweaver/src/suspendedstate.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the SuspendedState class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: SuspendedState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "suspendedstate_p.h"
-
-#include "threadweaver.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-SuspendedState::SuspendedState(Weaver *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void SuspendedState::suspend()
-{
- // this request is not handled in Suspended state
-}
-
-void SuspendedState::resume()
-{
- weaver()->setState(WorkingHard);
-}
-
-JobPointer SuspendedState::applyForWork(Thread *th, bool wasBusy)
-{
- // suspend all threads in case they wake up:
- Q_ASSERT(wasBusy == 0);
- weaver()->waitForAvailableJob(th);
- return weaver()->applyForWork(th, wasBusy);
-}
-
-StateId SuspendedState::stateId() const
-{
- return Suspended;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/suspendedstate_p.h b/src/3rdparty/threadweaver/src/suspendedstate_p.h
deleted file mode 100644
index 2f8177a1f..000000000
--- a/src/3rdparty/threadweaver/src/suspendedstate_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the SuspendedState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: SuspendedState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef SuspendedState_H
-#define SuspendedState_H
-
-#include "weaverimplstate_p.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-/** In SuspendedState, jobs are queued, but will not be executed. All
- * thread remains blocked. */
-class SuspendedState : public WeaverImplState
-{
-public:
- explicit SuspendedState(Weaver *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // SuspendedState_H
diff --git a/src/3rdparty/threadweaver/src/suspendingstate.cpp b/src/3rdparty/threadweaver/src/suspendingstate.cpp
deleted file mode 100644
index 635401f2d..000000000
--- a/src/3rdparty/threadweaver/src/suspendingstate.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the SuspendingState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: SuspendingState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "suspendingstate_p.h"
-
-#include "state.h"
-#include "weaver_p.h"
-#include "threadweaver.h"
-
-namespace ThreadWeaver
-{
-
-SuspendingState::SuspendingState(Weaver *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void SuspendingState::suspend()
-{
- // this request is not handled in Suspending state (we are already suspending...)
-}
-
-void SuspendingState::resume()
-{
- weaver()->setState(WorkingHard);
-}
-
-void SuspendingState::activated()
-{
- weaver()->reschedule();
-}
-
-JobPointer SuspendingState::applyForWork(Thread *th, bool wasBusy)
-{
- weaver()->takeFirstAvailableJobOrSuspendOrWait(th, wasBusy, true, true);
- weaver()->waitForAvailableJob(th);
- return weaver()->applyForWork(th, false);
-}
-
-StateId SuspendingState::stateId() const
-{
- return Suspending;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/suspendingstate_p.h b/src/3rdparty/threadweaver/src/suspendingstate_p.h
deleted file mode 100644
index d30e0ebea..000000000
--- a/src/3rdparty/threadweaver/src/suspendingstate_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the SuspendingState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: SuspendingState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef SuspendingState_H
-#define SuspendingState_H
-
-#include "weaverimplstate_p.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-/** SuspendingState is the state after suspend() has been called, but
- * before all threads finished executing the current job and blocked.
- */
-class SuspendingState : public WeaverImplState
-{
-public:
- explicit SuspendingState(Weaver *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** Overload. */
- void activated() Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // SuspendingState_H
diff --git a/src/3rdparty/threadweaver/src/thread.cpp b/src/3rdparty/threadweaver/src/thread.cpp
deleted file mode 100644
index 461c84209..000000000
--- a/src/3rdparty/threadweaver/src/thread.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the Thread class.
-
- Thread is not a part of the public interface of the ThreadWeaver library.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: Thread.cpp 25 2005-08-14 12:41:38Z mirko $
-*/
-
-#include "thread.h"
-
-#include <QtCore/QMutex>
-#include <QtCore/QDebug>
-#include <QPointer>
-#include <QtCore/QCoreApplication>
-
-#include "threadweaver.h"
-#include "weaver_p.h"
-#include "job.h"
-#include "debuggingaids.h"
-
-using namespace ThreadWeaver;
-
-class Thread::Private
-{
-public:
- explicit Private(Weaver *theParent)
- : parent(theParent)
- , id(makeId())
- , job(0)
- {
- Q_ASSERT(parent);
- }
-
- Weaver *parent;
- const unsigned int id;
- JobPointer job;
- QMutex mutex;
-
- static unsigned int makeId()
- {
- static QAtomicInt s_id(1);
- return s_id.fetchAndAddRelease(1);
- }
-};
-
-Thread::Thread(Weaver *parent)
- : QThread() // no parent, because the QObject hierarchy of this thread
- // does not have a parent (see QObject::pushToThread)
- , d(new Private(parent))
-{
- const QString queueName = parent->objectName().isEmpty()
- ? QString::fromLatin1("Queue(0x%1)").arg(quintptr(parent), 0, 16, QChar::fromLatin1('0'))
- : parent->objectName();
- setObjectName(QString::fromLatin1("%1[%2]").arg(queueName).arg(QString::number(id()), 2, QChar::fromLatin1('0')));
-}
-
-Thread::~Thread()
-{
- delete d;
-}
-
-unsigned int Thread::id()
-{
- return d->id; //id is const
-}
-
-void Thread::run()
-{
- Q_ASSERT(d->parent);
- Q_ASSERT(QCoreApplication::instance() != 0);
- d->parent->threadEnteredRun(this);
-
- emit started(this);
- debug(3, "Thread::run [%u]: running.\n", id());
-
- bool wasBusy = false;
- while (true) {
- debug(3, "Thread::run [%u]: trying to execute the next job.\n", id());
-
- // the assignment is intentional: newJob needs to go out of scope at the end of the if statement
- if (JobPointer newJob = d->parent->applyForWork(this, wasBusy)) {
- QMutexLocker l(&d->mutex); Q_UNUSED(l);
- d->job = newJob;
- } else {
- break;
- }
-
- wasBusy = true;
-
- emit jobStarted(d->job, this);
- d->job->execute(d->job, this);
- emit jobDone(d->job);
-
- QMutexLocker l(&d->mutex); Q_UNUSED(l);
- d->job.clear();
- }
- debug(3, "Thread::run [%u]: exiting.\n", id());
-}
-
-void Thread::requestAbort()
-{
- QMutexLocker l(&d->mutex); Q_UNUSED(l);
- if (d->job) {
- d->job->requestAbort();
- }
-}
-
diff --git a/src/3rdparty/threadweaver/src/thread.h b/src/3rdparty/threadweaver/src/thread.h
deleted file mode 100644
index 7d53348fe..000000000
--- a/src/3rdparty/threadweaver/src/thread.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the Thread class.
-
- Thread is not a part of the public interface of the ThreadWeaver library.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2004-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: Thread.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef THREADWEAVER_THREAD_H
-#define THREADWEAVER_THREAD_H
-
-#include <QtCore/QMutex>
-#include <QtCore/QThread>
-
-#include "threadweaver_export.h"
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Weaver;
-
-/** The class Thread is used to represent the worker threads in
- the weaver's inventory. It is not meant to be overloaded. */
-class THREADWEAVER_EXPORT Thread : public QThread
-{
- Q_OBJECT
-
-public:
- /** Create a thread.
- These thread objects are only used inside the Weaver parent
- object.
-
- @param parent the parent Weaver
- */
- explicit Thread(Weaver *parent = 0);
-
- /** The destructor. */
- ~Thread();
-
- /** Overload to execute the assigned jobs.
- Whenever the thread is idle, it will ask its Weaver parent for a
- Job to do. The Weaver will either return a Job or a Nil
- pointer. When a Nil pointer is returned, it tells the thread to
- exit.
- */
- void run() Q_DECL_OVERRIDE;
-
- /** Returns the thread id.
- This id marks the respective Thread object, and must
- therefore not be confused with, e.g., the pthread thread
- ID.
-
- Generally, the way threads are implemented is not
- specified. id() is the only way to uniquely identify a
- thread within ThreadWeaver.
- */
- unsigned int id();
-
- /** Request the abortion of the current job.
- If there is no current job, this method will do nothing, but can
- safely be called.
- It forwards the request to the current Job.
- */
- void requestAbort();
-
-Q_SIGNALS:
- /** The thread has been started. */
- void started(ThreadWeaver::Thread *);
- /** The thread started to process a job. */
- void jobStarted(ThreadWeaver::JobPointer, ThreadWeaver::Thread *);
- /** The thread finished to execute a job. */
- void jobDone(ThreadWeaver::JobPointer);
-
-private:
- class Private;
- Private *const d;
-};
-
-}
-
-#endif
-
diff --git a/src/3rdparty/threadweaver/src/threadweaver.cpp b/src/3rdparty/threadweaver/src/threadweaver.cpp
deleted file mode 100644
index a02dcd313..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the Weaver class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#include "threadweaver.h"
-
diff --git a/src/3rdparty/threadweaver/src/threadweaver.h b/src/3rdparty/threadweaver/src/threadweaver.h
deleted file mode 100644
index 3f926ab1d..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the public interfaces of the Weaver and the Job class.
- It should be the only include file necessary to use the ThreadWeaver
- library.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-#ifndef THREADWEAVER_H
-#define THREADWEAVER_H
-
-#include "queue.h"
-#include "queueing.h"
-#include "jobinterface.h"
-#include "jobpointer.h"
-#include "job.h"
-#include "collection.h"
-#include "sequence.h"
-#include "queueing.h"
-
-#endif // THREADWEAVER_H
diff --git a/src/3rdparty/threadweaver/src/threadweaver.pri b/src/3rdparty/threadweaver/src/threadweaver.pri
deleted file mode 100644
index 3f4fffc6c..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver.pri
+++ /dev/null
@@ -1,69 +0,0 @@
-CONFIG += exceptions
-
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/collection.h \
- $$PWD/debuggingaids.h \
- $$PWD/dependency.h \
- $$PWD/dependencypolicy.h \
- $$PWD/destructedstate_p.h \
- $$PWD/exception.h \
- $$PWD/executewrapper_p.h \
- $$PWD/executor_p.h \
- $$PWD/iddecorator.h \
- $$PWD/inconstructionstate_p.h \
- $$PWD/job.h \
- $$PWD/jobinterface.h \
- $$PWD/jobpointer.h \
- $$PWD/lambda.h \
- $$PWD/managedjobpointer.h \
- $$PWD/qobjectdecorator.h \
- $$PWD/queue.h \
- $$PWD/queueapi_p.h \
- $$PWD/queueing.h \
- $$PWD/queueinterface.h \
- $$PWD/queuepolicy.h \
- $$PWD/queuesignals.h \
- $$PWD/queuestream.h \
- $$PWD/resourcerestrictionpolicy.h \
- $$PWD/sequence.h \
- $$PWD/shuttingdownstate_p.h \
- $$PWD/state.h \
- $$PWD/suspendedstate_p.h \
- $$PWD/suspendingstate_p.h \
- $$PWD/thread.h \
- $$PWD/threadweaver.h \
- $$PWD/weaver_p.h \
- $$PWD/weaverimplstate_p.h \
- $$PWD/weaverinterface_p.h \
- $$PWD/workinghardstate_p.h
-
-SOURCES += \
- $$PWD/collection.cpp \
- $$PWD/debuggingaids.cpp \
- $$PWD/dependency.cpp \
- $$PWD/dependencypolicy.cpp \
- $$PWD/destructedstate.cpp \
- $$PWD/exception.cpp \
- $$PWD/executewrapper.cpp \
- $$PWD/executor.cpp \
- $$PWD/iddecorator.cpp \
- $$PWD/inconstructionstate.cpp \
- $$PWD/job.cpp \
- $$PWD/qobjectdecorator.cpp \
- $$PWD/queue.cpp \
- $$PWD/queueapi.cpp \
- $$PWD/queuesignals.cpp \
- $$PWD/queuestream.cpp \
- $$PWD/resourcerestrictionpolicy.cpp \
- $$PWD/sequence.cpp \
- $$PWD/shuttingdownstate.cpp \
- $$PWD/state.cpp \
- $$PWD/suspendedstate.cpp \
- $$PWD/suspendingstate.cpp \
- $$PWD/thread.cpp \
- $$PWD/threadweaver.cpp \
- $$PWD/weaver.cpp \
- $$PWD/weaverimplstate.cpp \
- $$PWD/workinghardstate.cpp
diff --git a/src/3rdparty/threadweaver/src/threadweaver_export.h b/src/3rdparty/threadweaver/src/threadweaver_export.h
deleted file mode 100644
index f9b29346b..000000000
--- a/src/3rdparty/threadweaver/src/threadweaver_export.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef THREADWEAVER_EXPORT_H
-#define THREADWEAVER_EXPORT_H
-
-#define THREADWEAVER_EXPORT
-
-#endif // THREADWEAVER_EXPORT_H
diff --git a/src/3rdparty/threadweaver/src/weaver.cpp b/src/3rdparty/threadweaver/src/weaver.cpp
deleted file mode 100644
index 5f2df89fb..000000000
--- a/src/3rdparty/threadweaver/src/weaver.cpp
+++ /dev/null
@@ -1,643 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the WeaverImpl class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: WeaverImpl.cpp 30 2005-08-16 16:16:04Z mirko $
-
-*/
-
-#include "weaver_p.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QObject>
-#include <QtCore/QMutex>
-#include <QtCore/QDebug>
-
-#include "job.h"
-#include "managedjobpointer.h"
-#include "state.h"
-#include "thread.h"
-#include "threadweaver.h"
-#include "debuggingaids.h"
-#include "suspendedstate_p.h"
-#include "suspendingstate_p.h"
-#include "destructedstate_p.h"
-#include "workinghardstate_p.h"
-#include "shuttingdownstate_p.h"
-#include "inconstructionstate_p.h"
-#include "queuepolicy.h"
-
-using namespace ThreadWeaver;
-
-/** @brief Constructs a Weaver object. */
-Weaver::Weaver(QObject *parent)
- : QueueAPI(parent)
- , m_active(0)
- , m_inventoryMax(qMax(4, 2 * QThread::idealThreadCount()))
- , m_mutex(new QMutex(QMutex::NonRecursive))
-{
- qRegisterMetaType<ThreadWeaver::JobPointer>("ThreadWeaver::JobPointer");
-
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- // initialize state objects:
- m_states[InConstruction] = QSharedPointer<State>(new InConstructionState(this));
- setState_p(InConstruction);
- m_states[WorkingHard] = QSharedPointer<State>(new WorkingHardState(this));
- m_states[Suspending] = QSharedPointer<State>(new SuspendingState(this));
- m_states[Suspended] = QSharedPointer<State>(new SuspendedState(this));
- m_states[ShuttingDown] = QSharedPointer<State>(new ShuttingDownState(this));
- m_states[Destructed] = QSharedPointer<State>(new DestructedState(this));
- setState_p(WorkingHard);
-}
-
-/** @brief Destructs a Weaver object. */
-Weaver::~Weaver()
-{
- Q_ASSERT_X(state()->stateId() == Destructed, Q_FUNC_INFO, "shutDown() method was not called before Weaver destructor!");
- delete m_mutex;
-}
-
-/** @brief Enter Destructed state.
- *
- * Once this method returns, it is save to delete this object.
- */
-void Weaver::shutDown()
-{
- state()->shutDown();
-}
-
-void Weaver::shutDown_p()
-{
- // the constructor may only be called from the thread that owns this
- // object (everything else would be what we professionals call "insane")
-
- REQUIRE(QThread::currentThread() == thread());
- debug(3, "WeaverImpl::shutDown: destroying inventory.\n");
- m_semaphore.acquire(m_createdThreads.loadAcquire());
- finish();
- suspend();
- setState(ShuttingDown);
- reschedule();
- m_jobFinished.wakeAll();
-
- // problem: Some threads might not be asleep yet, just finding
- // out if a job is available. Those threads will suspend
- // waiting for their next job (a rare case, but not impossible).
- // Therefore, if we encounter a thread that has not exited, we
- // have to wake it again (which we do in the following for
- // loop).
-
- for (;;) {
- Thread *th = 0;
- {
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- if (m_inventory.isEmpty()) {
- break;
- }
- th = m_inventory.takeFirst();
- }
- if (!th->isFinished()) {
- for (;;) {
- Q_ASSERT(state()->stateId() == ShuttingDown);
- reschedule();
- if (th->wait(100)) {
- break;
- }
- debug(1, "WeaverImpl::shutDown: thread %i did not exit as expected, "
- "retrying.\n", th->id());
- }
- }
- emit(threadExited(th));
- delete th;
- }
- Q_ASSERT(m_inventory.isEmpty());
- debug(3, "WeaverImpl::shutDown: done\n");
- setState(Destructed); // Destructed ignores all calls into the queue API
-}
-
-/** @brief Set the Weaver state.
- * @see StateId
- * @see WeaverImplState
- * @see State
- */
-void Weaver::setState(StateId id)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- setState_p(id);
-}
-
-void Weaver::setState_p(StateId id)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- State *newState = m_states[id].data();
- State *previous = m_state.fetchAndStoreOrdered(newState);
- if (previous == 0 || previous->stateId() != id) {
- newState->activated();
- debug(2, "WeaverImpl::setState: state changed to \"%s\".\n", newState->stateName().toLatin1().constData());
- if (id == Suspended) {
- emit(suspended());
- }
- emit(stateChanged(newState));
- }
-}
-
-const State *Weaver::state() const
-{
- return m_state.loadAcquire();
-}
-
-State *Weaver::state()
-{
- return m_state.loadAcquire();
-}
-
-void Weaver::setMaximumNumberOfThreads(int cap)
-{
- //FIXME really? Why not 0?
- Q_ASSERT_X(cap > 0, "Weaver Impl", "Thread inventory size has to be larger than zero.");
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->setMaximumNumberOfThreads(cap);
-}
-
-void Weaver::setMaximumNumberOfThreads_p(int cap)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- m_inventoryMax = cap;
-}
-
-int Weaver::maximumNumberOfThreads() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->maximumNumberOfThreads();
-}
-
-int Weaver::maximumNumberOfThreads_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_inventoryMax;
-}
-
-int Weaver::currentNumberOfThreads() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->currentNumberOfThreads();
-}
-
-int Weaver::currentNumberOfThreads_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_inventory.count();
-}
-
-void Weaver::enqueue(const QVector<JobPointer> &jobs)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->enqueue(jobs);
-}
-
-void Weaver::enqueue_p(const QVector<JobPointer> &jobs)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- if (jobs.isEmpty()) {
- return;
- }
- Q_FOREACH (const JobPointer &job, jobs) {
- if (job) {
- Q_ASSERT(job->status() == Job::Status_New);
- adjustInventory(1);
- debug(3, "WeaverImpl::enqueue: queueing job %p.\n", (void *)job.data());
- job->aboutToBeQueued(this);
- // find position for insertion:
- int i = m_assignments.size();
- if (i > 0) {
- while (i > 0 && m_assignments.at(i - 1)->priority() < job->priority()) {
- --i;
- }
- m_assignments.insert(i, job);
- } else {
- m_assignments.append(job);
- }
- job->setStatus(Job::Status_Queued);
- reschedule();
- }
- }
-}
-
-bool Weaver::dequeue(const JobPointer &job)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->dequeue(job);
-}
-
-bool Weaver::dequeue_p(JobPointer job)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- int position = m_assignments.indexOf(job);
- if (position != -1) {
- job->aboutToBeDequeued(this);
- int newPosition = m_assignments.indexOf(job);
- JobPointer job = m_assignments.takeAt(newPosition);
- job->setStatus(Job::Status_New);
- Q_ASSERT(!m_assignments.contains(job));
- debug(3, "WeaverImpl::dequeue: job %p dequeued, %i jobs left.\n", (void *)job.data(), queueLength_p());
- // from the queues point of view, a job is just as finished if it gets dequeued:
- m_jobFinished.wakeAll();
- Q_ASSERT(!m_assignments.contains(job));
- return true;
- } else {
- debug(3, "WeaverImpl::dequeue: job %p not found in queue.\n", (void *)job.data());
- return false;
- }
-}
-
-void Weaver::dequeue()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->dequeue();
-}
-
-void Weaver::dequeue_p()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- debug(3, "WeaverImpl::dequeue: dequeueing all jobs.\n");
- for (int index = 0; index < m_assignments.size(); ++index) {
- m_assignments.at(index)->aboutToBeDequeued(this);
- }
- m_assignments.clear();
- ENSURE(m_assignments.isEmpty());
-}
-
-void Weaver::finish()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->finish();
-}
-
-void Weaver::finish_p()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
-#ifdef QT_NO_DEBUG
- const int MaxWaitMilliSeconds = 50;
-#else
- const int MaxWaitMilliSeconds = 500;
-#endif
- while (!isIdle_p()) {
- Q_ASSERT_X(state()->stateId() == WorkingHard, Q_FUNC_INFO, qPrintable(state()->stateName()));
- debug(2, "WeaverImpl::finish: not done, waiting.\n");
- if (m_jobFinished.wait(m_mutex, MaxWaitMilliSeconds) == false) {
- debug(2, "WeaverImpl::finish: wait timed out, %i jobs left, waking threads.\n", queueLength_p());
- reschedule();
- }
- }
- debug(2, "WeaverImpl::finish: done.\n\n\n");
-}
-
-void Weaver::suspend()
-{
- //FIXME?
- //QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->suspend();
-}
-
-void Weaver::suspend_p()
-{
- //FIXME ?
-}
-
-void Weaver::resume()
-{
- //FIXME?
- //QMutexLocker l(m_mutex); Q_UNUSED(l);
- state()->resume();
-}
-
-void Weaver::resume_p()
-{
- //FIXME ?
-}
-
-bool Weaver::isEmpty() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->isEmpty();
-}
-
-bool Weaver::isEmpty_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_assignments.isEmpty();
-}
-
-bool Weaver::isIdle() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->isIdle();
-}
-
-bool Weaver::isIdle_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return isEmpty_p() && m_active == 0;
-}
-
-int Weaver::queueLength() const
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->queueLength();
-}
-
-int Weaver::queueLength_p() const
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_assignments.count();
-}
-
-void Weaver::requestAbort()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- return state()->requestAbort();
-}
-
-void Weaver::reschedule()
-{
- m_jobAvailable.wakeAll();
-}
-
-void Weaver::requestAbort_p()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- for (int i = 0; i < m_inventory.size(); ++i) {
- m_inventory[i]->requestAbort();
- }
-}
-
-/** @brief Adjust the inventory size.
- *
- * Requires that the mutex is being held when called.
- *
- * This method creates threads on demand. Threads in the inventory
- * are not created upon construction of the WeaverImpl object, but
- * when jobs are queued. This avoids costly delays on the application
- * startup time. Threads are created when the inventory size is under
- * inventoryMin and new jobs are queued.
- */
-//TODO add code to raise inventory size over inventoryMin
-//TODO add code to quit unnecessary threads
-void Weaver::adjustInventory(int numberOfNewJobs)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- //number of threads that can be created:
- const int reserve = m_inventoryMax - m_inventory.count();
-
- if (reserve > 0) {
- for (int i = 0; i < qMin(reserve, numberOfNewJobs); ++i) {
- Thread *th = createThread();
- th->moveToThread(th); // be sane from the start
- m_inventory.append(th);
- connect(th, SIGNAL(jobStarted(ThreadWeaver::JobPointer,ThreadWeaver::Thread*)),
- SIGNAL(threadBusy(ThreadWeaver::JobPointer,ThreadWeaver::Thread*)));
- connect(th, SIGNAL(jobDone(ThreadWeaver::JobPointer)),
- SIGNAL(jobDone(ThreadWeaver::JobPointer)));
- th->start();
- m_createdThreads.ref();
- debug(2, "WeaverImpl::adjustInventory: thread created, "
- "%i threads in inventory.\n", currentNumberOfThreads_p());
- }
- }
-}
-
-/** @brief Check with the assigned queue policies if the job can be executed.
- *
- * If it returns true, it expects that the job is executed right after that. The done() methods of the
- * queue policies will be automatically called when the job is finished.
- *
- * If it returns false, all queue policy resources have been freed, and the method can be called again
- * at a later time.
- */
-bool Weaver::canBeExecuted(JobPointer job)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
-
- QList<QueuePolicy *> acquired;
-
- bool success = true;
-
- QList<QueuePolicy *> policies = job->queuePolicies();
- if (!policies.isEmpty()) {
- debug(4, "WeaverImpl::canBeExecuted: acquiring permission from %i queue %s.\n",
- policies.size(), policies.size() == 1 ? "policy" : "policies");
- for (int index = 0; index < policies.size(); ++index) {
- if (policies.at(index)->canRun(job)) {
- acquired.append(policies.at(index));
- } else {
- success = false;
- break;
- }
- }
-
- debug(4, "WeaverImpl::canBeExecuted: queue policies returned %s.\n", success ? "true" : "false");
-
- if (!success) {
- for (int index = 0; index < acquired.size(); ++index) {
- acquired.at(index)->release(job);
- }
- }
- } else {
- debug(4, "WeaverImpl::canBeExecuted: no queue policies, this job can be executed.\n");
- }
- return success;
-}
-
-/** @brief Factory method to create the threads.
- *
- * Overload in adapted Weaver implementations.
- */
-Thread *Weaver::createThread()
-{
- return new Thread(this);
-}
-
-/** @brief Increment the count of active threads. */
-void Weaver::incActiveThreadCount()
-{
- adjustActiveThreadCount(1);
-}
-
-/** brief Decrement the count of active threads. */
-void Weaver::decActiveThreadCount()
-{
- adjustActiveThreadCount(-1);
- // the done job could have freed another set of jobs, and we do not know how
- // many - therefore we need to wake all threads:
- m_jobFinished.wakeAll();
-}
-
-/** @brief Adjust active thread count.
- *
- * This is a helper function for incActiveThreadCount and decActiveThreadCount.
- */
-void Weaver::adjustActiveThreadCount(int diff)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- m_active += diff;
- debug(4, "WeaverImpl::adjustActiveThreadCount: %i active threads (%i jobs"
- " in queue).\n", m_active, queueLength_p());
-
- if (m_assignments.isEmpty() && m_active == 0) {
- P_ASSERT(diff < 0); // cannot reach zero otherwise
- emit(finished());
- }
-}
-
-/** @brief Returns the number of active threads.
- *
- * Threads are active if they process a job. Requires that the mutex is being held when called.
- */
-int Weaver::activeThreadCount()
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- return m_active;
-}
-
-/** @brief Called from a new thread when entering the run method. */
-void Weaver::threadEnteredRun(Thread *thread)
-{
- m_semaphore.release(1);
- emit threadStarted(thread);
-}
-
-/** @brief Take the first available job out of the queue and return it.
- *
- * The job will be removed from the queue (therefore, take). Only jobs that have no unresolved dependencies
- * are considered available. If only jobs that depened on other unfinished jobs are in the queue, this method
- * blocks on m_jobAvailable.
- *
- * This method will enter suspended state if the active thread count is now zero and
- * suspendIfAllThreadsInactive is true.
- * If justReturning is true, do not assign a new job, just process the completed previous one.
- */
-JobPointer Weaver::takeFirstAvailableJobOrSuspendOrWait(Thread *th, bool threadWasBusy,
- bool suspendIfInactive, bool justReturning)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- Q_ASSERT(threadWasBusy == false || (threadWasBusy == true && m_active > 0));
-
-#ifndef QT_NO_DEBUG
- debug(3, "WeaverImpl::takeFirstAvailableJobOrWait: trying to assign new job to thread %i (%s state).\n",
- th->id(), qPrintable(state()->stateName()));
- debug(5, "WeaverImpl::takeFirstAvailableJobOrWait: %i active threads, was busy: %s, suspend: %s, assign new job: %s.\n",
- activeThreadCount(), threadWasBusy ? "yes" : "no", suspendIfInactive ? "yes" : "no", !justReturning ? "yes" : "no");
-#endif
-
- if (threadWasBusy) {
- // cleanup and send events:
- decActiveThreadCount();
- }
- Q_ASSERT(m_active >= 0);
-
- if (suspendIfInactive && m_active == 0 && state()->stateId() == Suspending) {
- setState_p(Suspended);
- return JobPointer();
- }
-
- if (state()->stateId() != WorkingHard || justReturning) {
- return JobPointer();
- }
-
- JobPointer next;
- for (int index = 0; index < m_assignments.size(); ++index) {
- const JobPointer &candidate = m_assignments.at(index);
- if (canBeExecuted(candidate)) {
- next = candidate;
- m_assignments.removeAt(index);
- break;
- }
- }
- if (next) {
- incActiveThreadCount();
- debug(3, "WeaverImpl::takeFirstAvailableJobOrWait: job %p assigned to thread %i (%s state).\n",
- next.data(), th->id(), qPrintable(state()->stateName()));
- return next;
- }
-
- blockThreadUntilJobsAreBeingAssigned_locked(th);
- return JobPointer();
-}
-
-/** @brief Assign a job to the calling thread.
- *
- * This is supposed to be called from the Thread objects in the inventory. Do not call this method from
- * your code.
- * Returns 0 if the weaver is shutting down, telling the calling thread to finish and exit. If no jobs are
- * available and shut down is not in progress, the calling thread is suspended until either condition is met.
- * @param wasBusy True if the thread is returning from processing a job
- */
-JobPointer Weaver::applyForWork(Thread *th, bool wasBusy)
-{
- return state()->applyForWork(th, wasBusy);
-}
-
-/** @brief Wait for a job to become available. */
-void Weaver::waitForAvailableJob(Thread *th)
-{
- state()->waitForAvailableJob(th);
-}
-
-/** @brief Blocks the calling thread until jobs can be assigned. */
-void Weaver::blockThreadUntilJobsAreBeingAssigned(Thread *th)
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- blockThreadUntilJobsAreBeingAssigned_locked(th);
-}
-
-/** @brief Blocks the calling thread until jobs can be assigned.
- *
- * The mutex must be held when calling this method.
- */
-void Weaver::blockThreadUntilJobsAreBeingAssigned_locked(Thread *th)
-{
- Q_ASSERT(!m_mutex->tryLock()); //mutex has to be held when this method is called
- debug(4, "WeaverImpl::blockThreadUntilJobsAreBeingAssigned_locked: thread %i blocked (%s state).\n",
- th->id(), qPrintable(state()->stateName()));
- emit threadSuspended(th);
- m_jobAvailable.wait(m_mutex);
- debug(4, "WeaverImpl::blockThreadUntilJobsAreBeingAssigned_locked: thread %i resumed (%s state).\n",
- th->id(), qPrintable(state()->stateName()));
-}
-
-/** @brief Dump the current jobs to the console.
- *
- * Use at your own risk.
- */
-void Weaver::dumpJobs()
-{
- QMutexLocker l(m_mutex); Q_UNUSED(l);
- debug(0, "WeaverImpl::dumpJobs: current jobs:\n");
- for (int index = 0; index < m_assignments.size(); ++index) {
- debug(0, "--> %4i: %p (priority %i, can be executed: %s)\n", index, (void *)m_assignments.at(index).data(),
- m_assignments.at(index)->priority(),
- canBeExecuted(m_assignments.at(index)) ? "yes" : "no");
- }
-}
-
diff --git a/src/3rdparty/threadweaver/src/weaver_p.h b/src/3rdparty/threadweaver/src/weaver_p.h
deleted file mode 100644
index 7523633e7..000000000
--- a/src/3rdparty/threadweaver/src/weaver_p.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the public interfaces of the WeaverImpl class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: WeaverImpl.h 32 2005-08-17 08:38:01Z mirko $
-*/
-#ifndef WeaverImpl_H
-#define WeaverImpl_H
-
-#include <QtCore/QObject>
-#include <QtCore/QWaitCondition>
-#include <QSharedPointer>
-#include <QAtomicPointer>
-#include <QAtomicInt>
-#include <QSemaphore>
-#include <QVector>
-
-#include "state.h"
-#include "queueapi_p.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-class WeaverImplState;
-class SuspendingState;
-
-/** @brief A Weaver manages worker threads.
- *
- * It creates an inventory of Thread objects to which it assigns jobs from its queue.
- * It extends the API of Queue, hiding methods that need to be public to implement state handling, but
- * should not be exposed in general.
- */
-class THREADWEAVER_EXPORT Weaver : public QueueAPI
-{
- Q_OBJECT
-public:
- explicit Weaver(QObject *parent = 0);
- virtual ~Weaver();
- void shutDown() Q_DECL_OVERRIDE;
- void shutDown_p() Q_DECL_OVERRIDE;
-
- const State *state() const Q_DECL_OVERRIDE;
- State *state() Q_DECL_OVERRIDE;
-
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
-
- void setState(StateId);
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE;
- bool dequeue(const JobPointer &job) Q_DECL_OVERRIDE;
- void dequeue() Q_DECL_OVERRIDE;
- void finish() Q_DECL_OVERRIDE;
- void suspend() Q_DECL_OVERRIDE;
- void resume() Q_DECL_OVERRIDE;
- bool isEmpty() const Q_DECL_OVERRIDE;
- bool isIdle() const Q_DECL_OVERRIDE;
- int queueLength() const Q_DECL_OVERRIDE;
- virtual JobPointer applyForWork(Thread *thread, bool wasBusy) Q_DECL_OVERRIDE;
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
- void blockThreadUntilJobsAreBeingAssigned(Thread *th);
- void blockThreadUntilJobsAreBeingAssigned_locked(Thread *th);
- void incActiveThreadCount();
- void decActiveThreadCount();
- int activeThreadCount();
-
- void threadEnteredRun(Thread *thread);
- JobPointer takeFirstAvailableJobOrSuspendOrWait(Thread *th, bool threadWasBusy,
- bool suspendIfAllThreadsInactive, bool justReturning);
- void requestAbort() Q_DECL_OVERRIDE;
- void reschedule() Q_DECL_OVERRIDE;
-
- void dumpJobs();
-
- //FIXME: rename _p to _locked:
- friend class WeaverImplState;
- friend class SuspendingState;
- void setState_p(StateId);
- void setMaximumNumberOfThreads_p(int cap) Q_DECL_OVERRIDE;
- int maximumNumberOfThreads_p() const Q_DECL_OVERRIDE;
- int currentNumberOfThreads_p() const Q_DECL_OVERRIDE;
- void enqueue_p(const QVector<JobPointer> &jobs);
- bool dequeue_p(JobPointer job) Q_DECL_OVERRIDE;
- void dequeue_p() Q_DECL_OVERRIDE;
- void finish_p() Q_DECL_OVERRIDE;
- void suspend_p() Q_DECL_OVERRIDE;
- void resume_p() Q_DECL_OVERRIDE;
- bool isEmpty_p() const Q_DECL_OVERRIDE;
- bool isIdle_p() const Q_DECL_OVERRIDE;
- int queueLength_p() const Q_DECL_OVERRIDE;
- void requestAbort_p() Q_DECL_OVERRIDE;
-
-Q_SIGNALS:
- /** @brief A Thread has been created. */
- void threadStarted(ThreadWeaver::Thread *);
- /** @brief A thread has exited. */
- void threadExited(ThreadWeaver::Thread *);
- /** @brief A thread has been suspended. */
- void threadSuspended(ThreadWeaver::Thread *);
- /** @brief The thread is busy executing job j. */
- void threadBusy(ThreadWeaver::JobPointer, ThreadWeaver::Thread *);
-
-protected:
- void adjustActiveThreadCount(int diff);
- virtual Thread *createThread();
- void adjustInventory(int noOfNewJobs);
-
-private:
- bool canBeExecuted(JobPointer);
- /** The thread inventory. */
- QList<Thread *> m_inventory;
- /** The job queue. */
- QList<JobPointer> m_assignments;
- /** The number of jobs that are assigned to the worker threads, but not finished. */
- int m_active;
- /** The maximum number of worker threads. */
- int m_inventoryMax;
- /** Wait condition all idle or done threads wait for. */
- QWaitCondition m_jobAvailable;
- /** Wait for a job to finish. */
- QWaitCondition m_jobFinished;
- /** Mutex to serialize operations. */
- QMutex *m_mutex;
- /** Semaphore to ensure thread startup is in sequence. */
- QSemaphore m_semaphore;
- /** Before shutdown can proceed to close the running threads, it needs to ensure that all of them
- * entered the run method. */
- QAtomicInt m_createdThreads;
- /** The state of the art.
- * @see StateId
- */
- QAtomicPointer<State> m_state;
- /** The state objects. */
- QSharedPointer<State> m_states[NoOfStates];
-};
-
-} // namespace ThreadWeaver
-
-#endif // WeaverImpl_H
diff --git a/src/3rdparty/threadweaver/src/weaverimplstate.cpp b/src/3rdparty/threadweaver/src/weaverimplstate.cpp
deleted file mode 100644
index b1ad4fcbb..000000000
--- a/src/3rdparty/threadweaver/src/weaverimplstate.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- C++ -*-
-
- This file implements the StateImplementation class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: InConstructionState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "weaverimplstate_p.h"
-
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-WeaverImplState::WeaverImplState(QueueSignals *weaver)
- : State(weaver)
-{}
-
-const State *WeaverImplState::state() const
-{
- return this;
-}
-
-void WeaverImplState::shutDown()
-{
- weaver()->shutDown_p();
-}
-
-Weaver *WeaverImplState::weaver()
-{
- Q_ASSERT(dynamic_cast<Weaver *>(State::weaver()));
- return static_cast<Weaver *>(State::weaver());
-}
-
-const Weaver *WeaverImplState::weaver() const
-{
- Q_ASSERT(dynamic_cast<const Weaver *>(State::weaver()));
- return static_cast<const Weaver *>(State::weaver());
-}
-
-void WeaverImplState::setMaximumNumberOfThreads(int cap)
-{
- weaver()->setMaximumNumberOfThreads_p(cap);
-}
-
-int WeaverImplState::maximumNumberOfThreads() const
-{
- return weaver()->maximumNumberOfThreads_p();
-}
-
-int WeaverImplState::currentNumberOfThreads() const
-{
- return weaver()->currentNumberOfThreads_p();
-}
-
-void WeaverImplState::enqueue(const QVector<JobPointer> &jobs)
-{
- weaver()->enqueue_p(jobs);
-}
-
-bool WeaverImplState::dequeue(const JobPointer &job)
-{
- return weaver()->dequeue_p(job);
-}
-
-void WeaverImplState::dequeue()
-{
- weaver()->dequeue_p();
-}
-
-void WeaverImplState::finish()
-{
- weaver()->finish_p();
-}
-
-bool WeaverImplState::isEmpty() const
-{
- return weaver()->isEmpty_p();
-}
-
-bool WeaverImplState::isIdle() const
-{
- return weaver()->isIdle_p();
-}
-
-int WeaverImplState::queueLength() const
-{
- return weaver()->queueLength_p();
-}
-
-void WeaverImplState::requestAbort()
-{
- return weaver()->requestAbort_p();
-}
-
-void WeaverImplState::reschedule()
-{
- // Not implemented, performed directly in Weaver::reschedule().
-}
-
-void WeaverImplState::waitForAvailableJob(Thread *th)
-{
- weaver()->blockThreadUntilJobsAreBeingAssigned(th);
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/weaverimplstate_p.h b/src/3rdparty/threadweaver/src/weaverimplstate_p.h
deleted file mode 100644
index ff6eb74f5..000000000
--- a/src/3rdparty/threadweaver/src/weaverimplstate_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the StateIMplementation class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id$
-*/
-
-#ifndef STATEIMPLEMENTATION_H
-#define STATEIMPLEMENTATION_H
-
-#include "state.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-class QueueSignals;
-
-/** @brief Base class for all WeaverImpl states. */
-class WeaverImplState : public State
-{
-public:
- explicit WeaverImplState(QueueSignals *weaver);
-
- const State *state() const Q_DECL_OVERRIDE;
-
- /** Shut down the queue. */
- void shutDown() Q_DECL_OVERRIDE;
- /** Set the maximum number of threads this Weaver object may start. */
- void setMaximumNumberOfThreads(int cap) Q_DECL_OVERRIDE;
- /** Get the maximum number of threads this Weaver may start. */
- int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
- /** Returns the current number of threads in the inventory. */
- int currentNumberOfThreads() const Q_DECL_OVERRIDE;
- /** Enqueue a job. */
- void enqueue(const QVector<JobPointer> &jobs) Q_DECL_OVERRIDE;
- /** Dequeue a job. */
- bool dequeue(const JobPointer &job) Q_DECL_OVERRIDE;
- /** Dequeue all jobs. */
- void dequeue() Q_DECL_OVERRIDE;
- /** Finish all queued jobs. */
- void finish() Q_DECL_OVERRIDE;
- /** Are no more jobs queued? */
- bool isEmpty() const Q_DECL_OVERRIDE;
- /** Are all threads waiting? */
- bool isIdle() const Q_DECL_OVERRIDE;
- /** How many jobs are currently queued? */
- int queueLength() const Q_DECL_OVERRIDE;
- /** Request abort for all queued and currently executed jobs. */
- void requestAbort() Q_DECL_OVERRIDE;
- /** Reschedule jobs to threads. */
- void reschedule() Q_DECL_OVERRIDE;
- /** Wait (by suspending the calling thread) until a job becomes available. */
- void waitForAvailableJob(Thread *th) Q_DECL_OVERRIDE;
-
-protected:
- /** Provide correct return type for WeaverImpl states. */
- Weaver *weaver() Q_DECL_OVERRIDE;
- const Weaver *weaver() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif
diff --git a/src/3rdparty/threadweaver/src/weaverinterface_p.h b/src/3rdparty/threadweaver/src/weaverinterface_p.h
deleted file mode 100644
index 2ce28edc2..000000000
--- a/src/3rdparty/threadweaver/src/weaverinterface_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the WeaverInterface class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-*/
-
-#ifndef THREADWEAVER_QUEUEINTERFACE_H
-#define THREADWEAVER_QUEUEINTERFACE_H
-
-#include "jobpointer.h"
-
-namespace ThreadWeaver
-{
-
-class Job;
-class Thread;
-
-class THREADWEAVER_EXPORT WeaverInterface
-{
-public:
- virtual ~WeaverInterface() {}
-
- /** @brief Assign a job to an idle thread.
- * @param th the thread to give a new Job to
- * @param wasBusy true if a job was previously assigned to the calling thread
- */
- virtual JobPointer applyForWork(Thread *th, bool wasBusy) = 0;
-
- /** @brief Wait (by suspending the calling thread) until a job becomes available. */
- virtual void waitForAvailableJob(Thread *th) = 0;
-};
-
-}
-
-#endif // THREADWEAVER_QUEUEINTERFACE_H
diff --git a/src/3rdparty/threadweaver/src/workinghardstate.cpp b/src/3rdparty/threadweaver/src/workinghardstate.cpp
deleted file mode 100644
index 0b1b9a79a..000000000
--- a/src/3rdparty/threadweaver/src/workinghardstate.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- C++ -*-
-
-This file implements the WorkingHardState class.
-
-$ Author: Mirko Boehm $
-$ Copyright: (C) 2005-2013 Mirko Boehm $
-$ Contact: mirko@kde.org
-http://www.kde.org
-http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
-$Id: WorkingHardState.cpp 30 2005-08-16 16:16:04Z mirko $
-*/
-
-#include "workinghardstate_p.h"
-
-#include <QtCore/QByteRef>
-
-#include "job.h"
-#include "thread.h"
-#include "weaver_p.h"
-#include "threadweaver.h"
-#include "debuggingaids.h"
-
-namespace ThreadWeaver
-{
-
-void WorkingHardState::activated()
-{
- weaver()->reschedule();
-}
-
-WorkingHardState::WorkingHardState(Weaver *weaver)
- : WeaverImplState(weaver)
-{
-}
-
-void WorkingHardState::suspend()
-{
- weaver()->setState(Suspending);
-}
-
-void WorkingHardState::resume()
-{
-}
-
-JobPointer WorkingHardState::applyForWork(Thread *th, bool wasBusy)
-{
- // beware: this code is executed in the applying thread!
- debug(2, "WorkingHardState::applyForWork: thread %i applies for work in %s state.\n", th->id(),
- qPrintable(weaver()->state()->stateName()));
- JobPointer next = weaver()->takeFirstAvailableJobOrSuspendOrWait(th, wasBusy, false, false);
- if (next) {
- return next;
- } else {
- // this is no infinite recursion: the state may have changed meanwhile, or jobs may have become available:
- debug(2, "WorkingHardState::applyForWork: repeating for thread %i in %s state.\n", th->id(),
- qPrintable(weaver()->state()->stateName()));
- return weaver()->applyForWork(th, false);
- }
-}
-
-StateId WorkingHardState::stateId() const
-{
- return WorkingHard;
-}
-
-}
diff --git a/src/3rdparty/threadweaver/src/workinghardstate_p.h b/src/3rdparty/threadweaver/src/workinghardstate_p.h
deleted file mode 100644
index 30a33ee3e..000000000
--- a/src/3rdparty/threadweaver/src/workinghardstate_p.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- C++ -*-
-
- This file declares the WorkingHardState class.
-
- $ Author: Mirko Boehm $
- $ Copyright: (C) 2005-2013 Mirko Boehm $
- $ Contact: mirko@kde.org
- http://www.kde.org
- http://creative-destruction.me $
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- $Id: WorkingHardState.h 32 2005-08-17 08:38:01Z mirko $
-*/
-
-#ifndef WorkingHardState_H
-#define WorkingHardState_H
-
-#include "weaverimplstate_p.h"
-#include "weaver_p.h"
-
-namespace ThreadWeaver
-{
-
-/* WorkingHardState handles the state dependent calls in the state where
- * jobs are executed. */
-class WorkingHardState : public WeaverImplState
-{
-public:
- explicit WorkingHardState(Weaver *weaver);
- /** Suspend job processing. */
- void suspend() Q_DECL_OVERRIDE;
- /** Resume job processing. */
- void resume() Q_DECL_OVERRIDE;
- /** Assign a job to an idle thread. */
- JobPointer applyForWork(Thread *th, bool wasBusy) Q_DECL_OVERRIDE;
- /** Overload. */
- void activated() Q_DECL_OVERRIDE;
- /** reimpl */
- StateId stateId() const Q_DECL_OVERRIDE;
-};
-
-}
-
-#endif // WorkingHardIState_H
diff --git a/src/3rdparty/threadweaver/threadweaver.yaml b/src/3rdparty/threadweaver/threadweaver.yaml
deleted file mode 100644
index c54f87b3f..000000000
--- a/src/3rdparty/threadweaver/threadweaver.yaml
+++ /dev/null
@@ -1 +0,0 @@
-tier: 1
diff --git a/src/core/core.pro b/src/core/core.pro
index cb9437700..bd965516e 100644
--- a/src/core/core.pro
+++ b/src/core/core.pro
@@ -6,6 +6,11 @@ load(qt_module)
DEFINES += QT3DCORE_LIBRARY
+# TODO: Make tasking API configurable
+#use_thread_weaver {
+# DEFINES += THREAD_WEAVER
+#}
+
QMAKE_DOCS = $$PWD/doc/qt3dcore.qdocconf
gcov {
@@ -17,7 +22,6 @@ gcov {
# otherwise mingw headers do not declare common functions like ::strcasecmp
win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
-include(../3rdparty/threadweaver/src/threadweaver.pri)
include(core.pri)
!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
diff --git a/src/core/jobs/jobs.pri b/src/core/jobs/jobs.pri
index 015b5efcd..b6def7aa8 100644
--- a/src/core/jobs/jobs.pri
+++ b/src/core/jobs/jobs.pri
@@ -1,6 +1,5 @@
SOURCES += \
- $$PWD/weaverjob.cpp \
$$PWD/qaspectjob.cpp \
$$PWD/qaspectjobmanager.cpp \
$$PWD/qabstractaspectjobmanager.cpp \
@@ -9,8 +8,16 @@ SOURCES += \
$$PWD/task.cpp \
$$PWD/dependencyhandler.cpp
+# TODO: Make tasking API configurable
+#use_thread_weaver {
+#SOURCES += \
+# $$PWD/weaverjob.cpp
+#
+#HEADERS += \
+# $$PWD/weaverjob_p.h \
+#}
+
HEADERS += \
- $$PWD/weaverjob_p.h \
$$PWD/qaspectjob.h \
$$PWD/qaspectjob_p.h \
$$PWD/qabstractaspectjobmanager.h \
diff --git a/src/core/jobs/qaspectjobmanager.cpp b/src/core/jobs/qaspectjobmanager.cpp
index af1774e65..970c6458e 100644
--- a/src/core/jobs/qaspectjobmanager.cpp
+++ b/src/core/jobs/qaspectjobmanager.cpp
@@ -34,18 +34,18 @@
**
****************************************************************************/
+#ifdef THREAD_WEAVER
#include <threadweaver.h>
#include <dependencypolicy.h>
#include <thread.h>
-
-#include "qaspectjobmanager.h"
#include "job.h"
#include "weaverjob_p.h"
+#endif
+
+#include "qaspectjobmanager.h"
#include "qaspectjobmanager_p.h"
-#ifdef THREAD_POOLER
#include "task_p.h"
#include "dependencyhandler_p.h"
-#endif
#include <QAtomicInt>
#include <QDebug>
@@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3D {
+#ifdef THREAD_WEAVER
namespace {
class SynchronizedJob : public ThreadWeaver::Job
@@ -96,11 +97,14 @@ void SynchronizedJob::run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *t
}
} // anonymous
+#endif
QAspectJobManagerPrivate::QAspectJobManagerPrivate(QAspectJobManager *qq)
: QAbstractAspectJobManagerPrivate()
, q_ptr(qq)
+#ifdef THREAD_WEAVER
, m_weaver(Q_NULLPTR)
+#endif
{
}
@@ -108,7 +112,7 @@ QAspectJobManager::QAspectJobManager(QObject *parent)
: QAbstractAspectJobManager(*new QAspectJobManagerPrivate(this), parent)
{
Q_D(QAspectJobManager);
-#ifndef THREAD_POOLER
+#ifdef THREAD_WEAVER
d->m_weaver = new ThreadWeaver::Queue(this);
d->m_weaver->setMaximumNumberOfThreads(QThread::idealThreadCount());
#else
@@ -124,7 +128,7 @@ QAspectJobManager::QAspectJobManager(QAspectJobManagerPrivate &dd, QObject *pare
: QAbstractAspectJobManager(dd, parent)
{
Q_D(QAspectJobManager);
-#ifndef THREAD_POOLER
+#ifdef THREAD_WEAVER
d->m_weaver = new ThreadWeaver::Queue(this);
d->m_weaver->setMaximumNumberOfThreads(QThread::idealThreadCount());
#else
@@ -143,7 +147,7 @@ void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
{
Q_D(QAspectJobManager);
-#ifndef THREAD_POOLER
+#ifdef THREAD_WEAVER
// Convert QJobs to ThreadWeaver::Jobs
QHash<QAspectJob *, QSharedPointer<WeaverJob> > jobsMap;
Q_FOREACH (const QAspectJobPtr &job, jobQueue) {
@@ -208,7 +212,7 @@ void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
void QAspectJobManager::waitForAllJobs()
{
Q_D(QAspectJobManager);
-#ifndef THREAD_POOLER
+#ifdef THREAD_WEAVER
d->m_weaver->finish();
#else
d->m_threadPooler->flush();
@@ -219,7 +223,7 @@ void QAspectJobManager::waitForPerThreadFunction(JobFunction func, void *arg)
{
Q_D(QAspectJobManager);
-#ifndef THREAD_POOLER
+#ifdef THREAD_WEAVER
const int threadCount = d->m_weaver->maximumNumberOfThreads();
QAtomicInt atomicCount(threadCount);
diff --git a/src/core/jobs/qaspectjobmanager_p.h b/src/core/jobs/qaspectjobmanager_p.h
index cde0351bf..5ea9cc54a 100644
--- a/src/core/jobs/qaspectjobmanager_p.h
+++ b/src/core/jobs/qaspectjobmanager_p.h
@@ -39,14 +39,14 @@
#include <private/qabstractaspectjobmanager_p.h>
-#ifdef THREAD_POOLER
#include "qthreadpooler_p.h"
#include "dependencyhandler_p.h"
-#endif
+#ifdef THREAD_WEAVER
namespace ThreadWeaver {
class Queue;
}
+#endif
QT_BEGIN_NAMESPACE
@@ -62,15 +62,15 @@ public:
Q_DECLARE_PUBLIC(QAspectJobManager)
QAspectJobManager *q_ptr;
+#ifdef THREAD_WEAVER
// Owned by QAspectJobManager via QObject parent-child
ThreadWeaver::Queue *m_weaver;
+#endif
-#ifdef THREAD_POOLER
QThreadPooler *m_threadPooler;
DependencyHandler *m_dependencyHandler;
QMutex *m_syncMutex;
QWaitCondition m_syncFinished;
-#endif
};
} // Qt3D