From 864eeb3a526b1a32c72e1f31a3e1f23dcc5c7409 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 9 Oct 2011 01:12:50 -0700 Subject: 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. --- includes/TaskMan.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'includes/TaskMan.h') 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 #include #include -#include +#include 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(t); } }; - typedef gnu::hash_set taskList; - taskList tasks, pendingAdd; - volatile bool stopped; + struct taskHasher { size_t operator()(const Task * t) const { return reinterpret_cast(t); } }; + typedef gnu::hash_set taskHash_t; + typedef std::vector taskList_t; + taskHash_t m_tasks; + taskList_t m_pendingAdd; + volatile bool m_stopped; }; }; -- cgit v1.2.3