summaryrefslogtreecommitdiff
path: root/includes/TaskMan.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-12-04 01:19:09 -0800
committerPixel <pixel@nobis-crew.org>2011-12-04 01:20:10 -0800
commitd440c3f50a918a932293ad98bcec96eaa4683222 (patch)
tree33e8e42a8e4506ae9da70cdb44dd133bde7f7219 /includes/TaskMan.h
parente5577eb7a643ce7885e5d14660a6d24254161622 (diff)
Reworked some things in the architecture, mainly exceptions and asserts.
-) Removed Assert() -) Added AAssert(), IAssert(), RAssert(), TAssert() and Failure() -) Reworked all asserts in the code, and added meaningful messages to them. -) Changed the way the startup code is generated; BALAU_STARTUP is no longer necessary.
Diffstat (limited to 'includes/TaskMan.h')
-rw-r--r--includes/TaskMan.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/includes/TaskMan.h b/includes/TaskMan.h
index 1e7a2f1..6a50491 100644
--- a/includes/TaskMan.h
+++ b/includes/TaskMan.h
@@ -27,13 +27,14 @@ class TaskMan {
public:
TaskMan();
~TaskMan();
- void mainLoop();
+ int mainLoop();
static TaskMan * getDefaultTaskMan();
struct ev_loop * getLoop() { return m_loop; }
void signalTask(Task * t);
- static void stop();
- void stopMe() { m_stopped = true; }
+ static void stop(int code);
+ void stopMe(int code) { m_stopped = true; m_stopCode = code; }
static Thread * createThreadedTaskMan();
+ bool stopped() { return m_stopped; }
private:
static void registerTask(Task * t, Task * stick);
void * getStack();
@@ -58,9 +59,10 @@ class TaskMan {
ev::async m_evt;
std::queue<void *> m_stacks;
int m_nStacks;
+ int m_stopCode;
};
template<class T>
-T * createTask(T * t, Task * stick) { TaskMan::registerTask(t, stick); Assert(dynamic_cast<Task *>(t)); return t; }
+T * createTask(T * t, Task * stick) { TaskMan::registerTask(t, stick); return t; }
};