From 1d9def9edae0011eeee8f83dc32fb3797ca2f46b Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 7 Oct 2011 15:36:12 -0700 Subject: 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 (!) --- includes/TaskMan.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'includes/TaskMan.h') 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 +#include +#include + +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(t); } }; + typedef gnu::hash_set taskList; + taskList tasks, pendingAdd; + volatile bool stopped; }; }; -- cgit v1.2.3