summaryrefslogtreecommitdiff
path: root/includes/TaskMan.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-09 01:12:50 -0700
committerPixel <pixel@nobis-crew.org>2011-10-09 01:12:50 -0700
commit864eeb3a526b1a32c72e1f31a3e1f23dcc5c7409 (patch)
tree7cc7037e2d7137180a67fb10b29469d4d68e677f /includes/TaskMan.h
parent4f7b984f9f848ba6adae2040c520a97bb5c0e354 (diff)
More work on the Task manager.
Now "Main" is a Task, among the most important changes. Introduced the notion of Events, and managed a coherent task switch. Also, renamed a lot of the variables to have a more coherent naming scheme.
Diffstat (limited to 'includes/TaskMan.h')
-rw-r--r--includes/TaskMan.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/includes/TaskMan.h b/includes/TaskMan.h
index ac95f71..585fb7f 100644
--- a/includes/TaskMan.h
+++ b/includes/TaskMan.h
@@ -1,8 +1,9 @@
#pragma once
+#include <stdint.h>
#include <coro.h>
#include <ext/hash_set>
-#include <stdint.h>
+#include <vector>
namespace gnu = __gnu_cxx;
@@ -15,18 +16,20 @@ class TaskMan {
TaskMan();
~TaskMan();
void mainLoop();
- void stop() { stopped = true; }
+ void stop() { m_stopped = true; }
static TaskMan * getTaskMan();
private:
void registerTask(Task * t);
void unregisterTask(Task * t);
- coro_context returnContext;
+ coro_context m_returnContext;
friend class Task;
- struct taskHash { size_t operator()(const Task * t) const { return reinterpret_cast<uintptr_t>(t); } };
- typedef gnu::hash_set<Task *, taskHash> taskList;
- taskList tasks, pendingAdd;
- volatile bool stopped;
+ struct taskHasher { size_t operator()(const Task * t) const { return reinterpret_cast<uintptr_t>(t); } };
+ typedef gnu::hash_set<Task *, taskHasher> taskHash_t;
+ typedef std::vector<Task *> taskList_t;
+ taskHash_t m_tasks;
+ taskList_t m_pendingAdd;
+ volatile bool m_stopped;
};
};