logic: run message handling in parallel per message
This commit is contained in:
@@ -187,8 +187,8 @@ private:
|
|||||||
SqliteIndexStorage m_sqliteIndexStorage;
|
SqliteIndexStorage m_sqliteIndexStorage;
|
||||||
SqliteBookmarkStorage m_sqliteBookmarkStorage;
|
SqliteBookmarkStorage m_sqliteBookmarkStorage;
|
||||||
|
|
||||||
mutable std::map <FilePath, Id> m_fileNodeIds;
|
std::map <FilePath, Id> m_fileNodeIds;
|
||||||
mutable std::map <Id, FilePath> m_fileNodePaths;
|
std::map <Id, FilePath> m_fileNodePaths;
|
||||||
|
|
||||||
HierarchyCache m_hierarchyCache;
|
HierarchyCache m_hierarchyCache;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "utility/logging/logging.h"
|
#include "utility/logging/logging.h"
|
||||||
#include "utility/messaging/MessageBase.h"
|
#include "utility/messaging/MessageBase.h"
|
||||||
#include "utility/messaging/MessageListenerBase.h"
|
#include "utility/messaging/MessageListenerBase.h"
|
||||||
#include "utility/scheduling/TaskGroupSequence.h"
|
#include "utility/scheduling/TaskGroupParallel.h"
|
||||||
#include "utility/scheduling/TaskLambda.h"
|
#include "utility/scheduling/TaskLambda.h"
|
||||||
|
|
||||||
std::shared_ptr<MessageQueue> MessageQueue::getInstance()
|
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
|
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);
|
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;
|
const int SLEEP_TIME_MS = 25;
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
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;
|
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);
|
std::lock_guard<std::mutex> lock(m_activeTaskCountMutex);
|
||||||
return m_activeTaskCount;
|
return m_activeTaskCount;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ private:
|
|||||||
virtual void doTerminate();
|
virtual void doTerminate();
|
||||||
|
|
||||||
void processTaskThreaded(std::shared_ptr<TaskInfo> taskInfo, std::shared_ptr<Blackboard> blackboard);
|
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;
|
std::vector<std::shared_ptr<TaskInfo>> m_tasks;
|
||||||
bool m_needsToStartThreads;
|
bool m_needsToStartThreads;
|
||||||
|
|||||||
Reference in New Issue
Block a user