Skip to content

Commit 9abc310

Browse files
committed
issue #9234 NUM_PROC_THREADS not being honored when processing input
In the proposed pull request #9235 the correct solution was given for the specific place. To overcome the problem to have to have the correction code at each place where `NUM_PROC_THREADS` is used the code is moved to a central place.
1 parent 91095fb commit 9abc310

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

src/configimpl.l

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,13 @@ void Config::checkAndCorrect(bool quiet, const bool check)
18081808
checkList(Config_getList(EXTRA_SEARCH_MAPPINGS),"EXTRA_SEARCH_MAPPING",TRUE,TRUE);
18091809
}
18101810

1811+
int numThreads = Config_getInt(NUM_PROC_THREADS);
1812+
if (numThreads==0)
1813+
{
1814+
numThreads = static_cast<int>(std::thread::hardware_concurrency());
1815+
Config_updateInt(NUM_PROC_THREADS,numThreads);
1816+
}
1817+
18111818
//------------------------
18121819

18131820
// check for settings that are inconsistent with having GENERATE_HTMLHELP enabled

src/doxygen.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8069,10 +8069,6 @@ static void generateFileSources()
80698069
#endif
80708070
{
80718071
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
8072-
if (numThreads==0)
8073-
{
8074-
numThreads = std::thread::hardware_concurrency();
8075-
}
80768072
if (numThreads>1)
80778073
{
80788074
msg("Generating code files using %zu threads.\n",numThreads);
@@ -8151,10 +8147,6 @@ static void generateFileDocs()
81518147
if (!Doxygen::inputNameLinkedMap->empty())
81528148
{
81538149
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
8154-
if (numThreads==0)
8155-
{
8156-
numThreads = std::thread::hardware_concurrency();
8157-
}
81588150
if (numThreads>1) // multi threaded processing
81598151
{
81608152
struct DocContext
@@ -8439,10 +8431,6 @@ static void countMembers()
84398431
static void generateDocsForClassList(const std::vector<ClassDefMutable*> &classList)
84408432
{
84418433
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
8442-
if (numThreads==0)
8443-
{
8444-
numThreads = std::thread::hardware_concurrency();
8445-
}
84468434
if (numThreads>1) // multi threaded processing
84478435
{
84488436
struct DocContext
@@ -9417,10 +9405,6 @@ static void generateGroupDocs()
94179405
static void generateNamespaceClassDocs(const ClassLinkedRefMap &classList)
94189406
{
94199407
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
9420-
if (numThreads==0)
9421-
{
9422-
numThreads = std::thread::hardware_concurrency();
9423-
}
94249408
if (numThreads>1) // multi threaded processing
94259409
{
94269410
struct DocContext
@@ -9970,10 +9954,6 @@ static void parseFilesMultiThreading(const std::shared_ptr<Entry> &root)
99709954
std::mutex processedFilesLock;
99719955
// process source files (and their include dependencies)
99729956
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
9973-
if (numThreads==0)
9974-
{
9975-
numThreads = std::thread::hardware_concurrency();
9976-
}
99779957
msg("Processing input using %zu threads.\n",numThreads);
99789958
ThreadPool threadPool(numThreads);
99799959
using FutureType = std::vector< std::shared_ptr<Entry> >;
@@ -10076,7 +10056,7 @@ static void parseFilesMultiThreading(const std::shared_ptr<Entry> &root)
1007610056
else // normal processing
1007710057
#endif
1007810058
{
10079-
std::size_t numThreads = std::thread::hardware_concurrency();
10059+
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
1008010060
msg("Processing input using %zu threads.\n",numThreads);
1008110061
ThreadPool threadPool(numThreads);
1008210062
using FutureType = std::shared_ptr<Entry>;

0 commit comments

Comments
 (0)