logic: run message handling in parallel per message

This commit is contained in:
Eberhard Graether
2017-04-19 14:26:28 +02:00
parent 33ff346d3b
commit 01bd0efefb
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -187,8 +187,8 @@ private:
SqliteIndexStorage m_sqliteIndexStorage;
SqliteBookmarkStorage m_sqliteBookmarkStorage;
mutable std::map <FilePath, Id> m_fileNodeIds;
mutable std::map <Id, FilePath> m_fileNodePaths;
std::map <FilePath, Id> m_fileNodeIds;
std::map <Id, FilePath> m_fileNodePaths;
HierarchyCache m_hierarchyCache;
};
+2 -2
View File
@@ -6,7 +6,7 @@
#include "utility/logging/logging.h"
#include "utility/messaging/MessageBase.h"
#include "utility/messaging/MessageListenerBase.h"
#include "utility/scheduling/TaskGroupSequence.h"
#include "utility/scheduling/TaskGroupParallel.h"
#include "utility/scheduling/TaskLambda.h"
std::shared_ptr<MessageQueue> MessageQueue::getInstance()
@@ -258,7 +258,7 @@ void MessageQueue::sendMessage(std::shared_ptr<MessageBase> message)
void MessageQueue::sendMessageAsTask(std::shared_ptr<MessageBase> message, bool asNextTask) const
{
std::shared_ptr<TaskGroupSequence> taskGroup = std::make_shared<TaskGroupSequence>();
std::shared_ptr<TaskGroupParallel> taskGroup = std::make_shared<TaskGroupParallel>();
{
std::lock_guard<std::mutex> lock(m_listenersMutex);
@@ -41,7 +41,7 @@ Task::TaskState TaskGroupParallel::doUpdate(std::shared_ptr<Blackboard> blackboa
const int SLEEP_TIME_MS = 25;
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
if (m_tasks.size() != 0 && getActveTaskCount() > 0)
if (m_tasks.size() != 0 && getActiveTaskCount() > 0)
{
return STATE_RUNNING;
}
@@ -109,7 +109,7 @@ void TaskGroupParallel::processTaskThreaded(std::shared_ptr<TaskInfo> taskInfo,
}
}
int TaskGroupParallel::getActveTaskCount() const
int TaskGroupParallel::getActiveTaskCount() const
{
std::lock_guard<std::mutex> lock(m_activeTaskCountMutex);
return m_activeTaskCount;
@@ -36,7 +36,7 @@ private:
virtual void doTerminate();
void processTaskThreaded(std::shared_ptr<TaskInfo> taskInfo, std::shared_ptr<Blackboard> blackboard);
int getActveTaskCount() const;
int getActiveTaskCount() const;
std::vector<std::shared_ptr<TaskInfo>> m_tasks;
bool m_needsToStartThreads;