summaryrefslogtreecommitdiff
path: root/includes/Task.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-21 18:32:27 -0800
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-21 18:32:27 -0800
commit9754372d5e4125bf5850d9cd3ae93d529efdef8d (patch)
treefc20e375256b95bbd13fecde0d85181100a198e4 /includes/Task.h
parent9697add8b75b96662c8d39477e58d5841c4b9cba (diff)
Preliminary WebSocket protocol support.
Diffstat (limited to 'includes/Task.h')
-rw-r--r--includes/Task.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/Task.h b/includes/Task.h
index 1041d08..7521b9f 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -50,6 +50,10 @@ class BaseEvent {
virtual ~BaseEvent() { if (m_cb) delete m_cb; }
bool gotSignal() { return m_signal; }
void doSignal();
+ void resetMaybe() {
+ if (m_task)
+ reset();
+ }
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");
@@ -60,12 +64,13 @@ class BaseEvent {
void registerOwner(Task * task) {
if (m_task == task)
return;
- AAssert(m_task == NULL, "Can't register an event for another task");
+ AAssert(m_task == NULL || relaxed(), "Can't register an event for another task");
m_task = task;
gotOwner(task);
}
protected:
virtual void gotOwner(Task * task) { }
+ virtual bool relaxed() { return false; }
private:
Callback * m_cb = NULL;
bool m_signal = false;