logic: made parsing interruptable by introducing TaskScheduler
This change introduces the TaskScheduler, which queues and processes Tasks on a separate thread. The Task class provides a common interface for deriving all specific tasks. A task can split it's processing into multiple update calls. The TaskScheduler will update a task until it is finished or interrupt it when necessary. TaskGroups can be used to bundle multiple Tasks together. So far only TaskGroupSequential was implemented which runs the Tasks in the set order. TaskParseCxx utilizes the CxxParser to parse each source file in a single update call. Parsing can be interrupted using the ESC key. The Statusbar shows the parsing progress.
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
class MessageFinishedParsing: public Message<MessageFinishedParsing>
|
||||
{
|
||||
public:
|
||||
MessageFinishedParsing(size_t fileCount, float parseTime, size_t errorCount)
|
||||
MessageFinishedParsing(size_t fileCount, size_t totalFileCount, float parseTime, size_t errorCount)
|
||||
: fileCount(fileCount)
|
||||
, totalFileCount(totalFileCount)
|
||||
, parseTime(parseTime)
|
||||
, errorCount(errorCount)
|
||||
{
|
||||
@@ -19,6 +20,7 @@ public:
|
||||
}
|
||||
|
||||
size_t fileCount;
|
||||
size_t totalFileCount;
|
||||
float parseTime;
|
||||
size_t errorCount;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MESSAGE_INTERRUPT_TASKS_H
|
||||
#define MESSAGE_INTERRUPT_TASKS_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageInterruptTasks:
|
||||
public Message<MessageInterruptTasks>
|
||||
{
|
||||
public:
|
||||
MessageInterruptTasks()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageInterruptTasks";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_INTERRUPT_TASKS_H
|
||||
Reference in New Issue
Block a user