ThreadManager: Make TaskType a property of a Task.

This commit is contained in:
Unknown W. Brackets committed 2021-12-05 21:01:49 -08:00
1 parent f9bab64bdf
commit 8b5173350f
6 files changed
+30 -12

No files matched your search

+3 -2
View File
@@ -14,6 +14,7 @@ enum class TaskType {
class Task {
public:
virtual ~Task() {}
virtual TaskType Type() const = 0;
virtual void Run() = 0;
virtual bool Cancellable() { return false; }
virtual void Cancel() {}
@@ -44,8 +45,8 @@ public:
// It gets even trickier when you think about mobile chips with BIG/LITTLE, but we'll
// just ignore it and let the OS handle it.
void Init(int numCores, int numLogicalCoresPerCpu);
void EnqueueTask(Task *task, TaskType taskType);
void EnqueueTaskOnThread(int threadNum, Task *task, TaskType taskType);
void EnqueueTask(Task *task);
void EnqueueTaskOnThread(int threadNum, Task *task);
void Teardown();
bool IsInitialized() const;