Improve logging for the WorkQueue class

fixes #12336
This commit is contained in:
Gunnar Beutner 2016-08-09 12:39:07 +02:00
parent 4c7e2994a7
commit f3bb628d6e
3 changed files with 8 additions and 0 deletions

View File

@ -79,6 +79,9 @@ void WorkQueue::Enqueue(const boost::function<void (void)>& function, WorkQueueP
boost::mutex::scoped_lock lock(m_Mutex);
if (!m_Spawned) {
Log(LogNotice, "WorkQueue")
<< "Spawning WorkQueue threads for '" << m_Name << "'";
for (int i = 0; i < m_ThreadCount; i++) {
m_Threads.create_thread(boost::bind(&WorkQueue::WorkerThreadProc, this));
}
@ -116,6 +119,9 @@ void WorkQueue::Join(bool stop)
m_Threads.join_all();
m_Spawned = false;
Log(LogNotice, "WorkQueue")
<< "Stopped WorkQueue threads for '" << m_Name << "'";
}
}

View File

@ -282,6 +282,7 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
{
WorkQueue upq(25000, Application::GetConcurrency());
upq.SetName("DaemonCommand::Run");
// activate config only after daemonization: it starts threads and that is not compatible with fork()
if (!ConfigItem::ActivateItems(upq, newItems)) {

View File

@ -168,6 +168,7 @@ bool DaemonUtility::LoadConfigFiles(const std::vector<std::string>& configs,
}
WorkQueue upq(25000, Application::GetConcurrency());
upq.SetName("DaemonUtility::LoadConfigFiles");
bool result = ConfigItem::CommitItems(ascope.GetContext(), upq, newItems);
if (!result) {