diff options
author | Pixel <pixel@nobis-crew.org> | 2011-12-04 01:19:09 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-12-04 01:20:10 -0800 |
commit | d440c3f50a918a932293ad98bcec96eaa4683222 (patch) | |
tree | 33e8e42a8e4506ae9da70cdb44dd133bde7f7219 /includes/Task.h | |
parent | e5577eb7a643ce7885e5d14660a6d24254161622 (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/Task.h')
-rw-r--r-- | includes/Task.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/includes/Task.h b/includes/Task.h index 2e52747..03233f8 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -38,9 +38,20 @@ class BaseEvent { virtual ~BaseEvent() { if (m_cb) delete m_cb; } bool gotSignal() { return m_signal; } void doSignal(); - void reset() { Assert(m_task != NULL); m_signal = false; gotOwner(m_task); } - Task * taskWaiting() { Assert(m_task); return m_task; } - void registerOwner(Task * task) { if (m_task == task) return; Assert(m_task == NULL); m_task = task; gotOwner(task); } + void reset() { + // could be potentially changed into a simple return + AAssert(m_task != NULL, "Can't reset an event that doesn't have a task"); + m_signal = false; + gotOwner(m_task); + } + Task * taskWaiting() { AAssert(m_task, "No task is waiting for that event"); return m_task; } + void registerOwner(Task * task) { + if (m_task == task) + return; + AAssert(m_task == NULL, "Can't register an event for another task"); + m_task = task; + gotOwner(task); + } protected: virtual void gotOwner(Task * task) { } private: |