Skip to content

Commit

Permalink
issue #9234 NUM_PROC_THREADS not being honored when processing input
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
albert-github committed Mar 30, 2022
1 parent 91095fb commit 9abc310
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
7 changes: 7 additions & 0 deletions src/configimpl.l
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,13 @@ void Config::checkAndCorrect(bool quiet, const bool check)
checkList(Config_getList(EXTRA_SEARCH_MAPPINGS),"EXTRA_SEARCH_MAPPING",TRUE,TRUE);
}

int numThreads = Config_getInt(NUM_PROC_THREADS);
if (numThreads==0)
{
numThreads = static_cast<int>(std::thread::hardware_concurrency());
Config_updateInt(NUM_PROC_THREADS,numThreads);
}

//------------------------

// check for settings that are inconsistent with having GENERATE_HTMLHELP enabled
Expand Down
22 changes: 1 addition & 21 deletions src/doxygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8069,10 +8069,6 @@ static void generateFileSources()
#endif
{
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
if (numThreads==0)
{
numThreads = std::thread::hardware_concurrency();
}
if (numThreads>1)
{
msg("Generating code files using %zu threads.\n",numThreads);
Expand Down Expand Up @@ -8151,10 +8147,6 @@ static void generateFileDocs()
if (!Doxygen::inputNameLinkedMap->empty())
{
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
if (numThreads==0)
{
numThreads = std::thread::hardware_concurrency();
}
if (numThreads>1) // multi threaded processing
{
struct DocContext
Expand Down Expand Up @@ -8439,10 +8431,6 @@ static void countMembers()
static void generateDocsForClassList(const std::vector<ClassDefMutable*> &classList)
{
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
if (numThreads==0)
{
numThreads = std::thread::hardware_concurrency();
}
if (numThreads>1) // multi threaded processing
{
struct DocContext
Expand Down Expand Up @@ -9417,10 +9405,6 @@ static void generateGroupDocs()
static void generateNamespaceClassDocs(const ClassLinkedRefMap &classList)
{
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
if (numThreads==0)
{
numThreads = std::thread::hardware_concurrency();
}
if (numThreads>1) // multi threaded processing
{
struct DocContext
Expand Down Expand Up @@ -9970,10 +9954,6 @@ static void parseFilesMultiThreading(const std::shared_ptr<Entry> &root)
std::mutex processedFilesLock;
// process source files (and their include dependencies)
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
if (numThreads==0)
{
numThreads = std::thread::hardware_concurrency();
}
msg("Processing input using %zu threads.\n",numThreads);
ThreadPool threadPool(numThreads);
using FutureType = std::vector< std::shared_ptr<Entry> >;
Expand Down Expand Up @@ -10076,7 +10056,7 @@ static void parseFilesMultiThreading(const std::shared_ptr<Entry> &root)
else // normal processing
#endif
{
std::size_t numThreads = std::thread::hardware_concurrency();
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
msg("Processing input using %zu threads.\n",numThreads);
ThreadPool threadPool(numThreads);
using FutureType = std::shared_ptr<Entry>;
Expand Down

0 comments on commit 9abc310

Please sign in to comment.