logic: reimplemented task system to abort ast visiting
* reimplemented interrupting TaskParseCxx by adding a listener for the MessageInterruptTask and returning a failure status code on update. This cancels the parent sequence task which results in the indexed items not getting inserted into the persistent storage * removed the capability for interrupting from TaskScheduler * changed task system to be closer to the standard behavior tree implementation * changed task system to accommodate the 3 status return types: Running, Success and Failure * made TaskGroupSequential fail once a member task fails * made TaskGroupParallel fail once a member task fails * split TaskParse... into one task for indexing and one task for injecting * added TaskRunner that handles updating and resetting the managed task * fixed numbers that are shown as parsed file count in indexing ui * fixed deadlock that originated from interaction between TaskScheduler and MessageQueue (one thread wanted to destroy a message listener on a task while the other one wanted to send as message as a task)
This commit is contained in:
+12
-1
@@ -6,6 +6,8 @@
|
||||
#include "data/parser/java/TaskParseJava.h"
|
||||
#include "data/PersistentStorage.h"
|
||||
#include "data/TaskCleanStorage.h"
|
||||
#include "data/TaskInjectStorage.h"
|
||||
#include "data/TaskRepeatWhileUnparsedSourceFilesAvailable.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
@@ -327,7 +329,16 @@ bool Project::buildIndex(bool forceRefresh)
|
||||
|
||||
for (int i = 0; i < indexerThreadCount; i++)
|
||||
{
|
||||
taskParallelIndexing->addTask(createIndexerTask(m_storage.get(), storageMutex, fileRegister));
|
||||
std::shared_ptr<TaskRepeatWhileUnparsedSourceFilesAvailable> taskRepeat = std::make_shared<TaskRepeatWhileUnparsedSourceFilesAvailable>(fileRegister);
|
||||
taskParallelIndexing->addTask(taskRepeat);
|
||||
|
||||
std::shared_ptr<TaskGroupSequential> taskRepeatSequential = std::make_shared<TaskGroupSequential>();
|
||||
taskRepeat->setTask(taskRepeatSequential);
|
||||
|
||||
std::shared_ptr<IntermediateStorage> intermediateStorage = std::make_shared<IntermediateStorage>();
|
||||
|
||||
taskRepeatSequential->addTask(createIndexerTask(intermediateStorage, fileRegister));
|
||||
taskRepeatSequential->addTask(std::make_shared<TaskInjectStorage>(intermediateStorage, m_storage));
|
||||
}
|
||||
|
||||
Task::dispatch(taskSequential);
|
||||
|
||||
Reference in New Issue
Block a user