Skip to content

Commit

Permalink
Allow multi-threaded computation of tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
doxygen committed Apr 29, 2022
1 parent 98f3c95 commit 120dd03
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
36 changes: 32 additions & 4 deletions src/doxygen.cpp
Expand Up @@ -8379,12 +8379,40 @@ static bool isSymbolHidden(const Definition *d)

static void computeTooltipTexts()
{
for (const auto &kv : *Doxygen::symbolMap)
std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
if (numThreads>1)
{
ThreadPool threadPool(numThreads);
std::vector < std::future< int > > results;
// queue the work
std::atomic_int count=0;
for (const auto &kv : *Doxygen::symbolMap)
{
DefinitionMutable *dm = toDefinitionMutable(kv.second);
if (dm && !isSymbolHidden(toDefinition(dm)) && toDefinition(dm)->isLinkableInProject())
{
auto processTooltip = [dm,&count]() {
dm->computeTooltip();
return count++;
};
results.emplace_back(threadPool.queue(processTooltip));
}
}
// wait for the results
for (auto &f : results)
{
auto i = f.get();
}
}
else
{
DefinitionMutable *dm = toDefinitionMutable(kv.second);
if (dm && !isSymbolHidden(toDefinition(dm)) && toDefinition(dm)->isLinkableInProject())
for (const auto &kv : *Doxygen::symbolMap)
{
dm->computeTooltip();
DefinitionMutable *dm = toDefinitionMutable(kv.second);
if (dm && !isSymbolHidden(toDefinition(dm)) && toDefinition(dm)->isLinkableInProject())
{
dm->computeTooltip();
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/message.cpp
Expand Up @@ -29,7 +29,7 @@ static const char * g_warningStr = "warning: ";
static const char * g_errorStr = "error: ";
static FILE * g_warnFile = stderr;
static WARN_AS_ERROR_t g_warnBehavior = WARN_AS_ERROR_t::NO;
static bool g_warnStat = false;
static std::atomic_bool g_warnStat = false;
static std::mutex g_mutex;

void initWarningFormat()
Expand Down

0 comments on commit 120dd03

Please sign in to comment.