From d440c3f50a918a932293ad98bcec96eaa4683222 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 4 Dec 2011 01:19:09 -0800 Subject: 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. --- includes/Task.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'includes/Task.h') 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: -- cgit v1.2.3