From f2cfa1707c713c7bb01d16f4c2c4d96803ea6793 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 6 Apr 2012 11:40:55 -0700 Subject: Making it simplier to register a task and wait for it. Also renamed createTask to registerTask, which makes way more sense. --- includes/TaskMan.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'includes/TaskMan.h') diff --git a/includes/TaskMan.h b/includes/TaskMan.h index 68aaaf6..35e60ed 100644 --- a/includes/TaskMan.h +++ b/includes/TaskMan.h @@ -20,6 +20,7 @@ class TaskScheduler; namespace Events { class Async; +class TaskEvent; }; @@ -54,10 +55,12 @@ class TaskMan { } bool stopped() { return m_stopped; } template - static T * createTask(T * t, Task * stick = NULL) { TaskMan::registerTask(t, stick); return t; } + static T * registerTask(T * t, Task * stick = NULL) { TaskMan::iRegisterTask(t, stick, NULL); return t; } + template + static T * registerTask(T * t, Events::TaskEvent * event) { TaskMan::iRegisterTask(t, NULL, event); return t; } private: - static void registerTask(Task * t, Task * stick); + static void iRegisterTask(Task * t, Task * stick, Events::TaskEvent * event); void * getStack(); void freeStack(void * stack); void addToPending(Task * t); @@ -68,8 +71,6 @@ class TaskMan { #endif friend class Task; friend class TaskScheduler; - template - friend T * createTask(T * t, Task * stick = NULL); struct taskHasher { size_t operator()(const Task * t) const { return reinterpret_cast(t); } }; typedef gnu::hash_set taskHash_t; taskHash_t m_tasks, m_signaledTasks; -- cgit v1.2.3