summaryrefslogtreecommitdiff
path: root/includes/TaskMan.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-07 15:36:12 -0700
committerPixel <pixel@nobis-crew.org>2011-10-07 15:36:12 -0700
commit1d9def9edae0011eeee8f83dc32fb3797ca2f46b (patch)
tree29077945287dd4b0c13269b9f3e5dc97936551f9 /includes/TaskMan.h
parent5a283e5b2b523d53e3504292c386b534dc74386a (diff)
More work in the Task manager.
Also fixing a few bugs linked with the printer and TLS. Removed flto from compilation flags: this actually creates bad code (!)
Diffstat (limited to 'includes/TaskMan.h')
-rw-r--r--includes/TaskMan.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/includes/TaskMan.h b/includes/TaskMan.h
index 05e5fa8..ac95f71 100644
--- a/includes/TaskMan.h
+++ b/includes/TaskMan.h
@@ -1,6 +1,10 @@
#pragma once
#include <coro.h>
+#include <ext/hash_set>
+#include <stdint.h>
+
+namespace gnu = __gnu_cxx;
namespace Balau {
@@ -11,11 +15,18 @@ class TaskMan {
TaskMan();
~TaskMan();
void mainLoop();
+ void stop() { stopped = true; }
+ static TaskMan * getTaskMan();
private:
- static TaskMan * getTaskMan();
+ void registerTask(Task * t);
+ void unregisterTask(Task * t);
coro_context 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;
};
};