summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-17 21:18:50 -0700
committerPixel <pixel@nobis-crew.org>2011-10-17 21:18:50 -0700
commitfb01d48ff535d34773e57c2e779455fe0edb2007 (patch)
tree5a01348fb4fc6ba7597b9c9e17dd87adc0e1ffc8 /includes
parentbc4f9afa3e19fc7f7b9fd642bf6bf170b319f5f7 (diff)
Adding the Async event, and tweaking the others a bit.
Diffstat (limited to 'includes')
-rw-r--r--includes/Task.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/includes/Task.h b/includes/Task.h
index 64156ba..042624d 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -49,9 +49,10 @@ class BaseEvent {
class Timeout : public BaseEvent {
public:
- Timeout(ev_tstamp tstamp);
- void evt_cb(ev::timer & w, int revents);
- void set(ev_tstamp tstamp);
+ Timeout(ev_tstamp tstamp) { set(tstamp); }
+ virtual ~Timeout() { m_evt.stop(); }
+ void evt_cb(ev::timer & w, int revents) { doSignal(); }
+ void set(ev_tstamp tstamp) { m_evt.set<Timeout, &Timeout::evt_cb>(this); m_evt.set(tstamp); }
private:
virtual void gotOwner(Task * task);
ev::timer m_evt;
@@ -60,9 +61,24 @@ class Timeout : public BaseEvent {
class TaskEvent : public BaseEvent {
public:
TaskEvent(Task * taskWaited);
+ virtual ~TaskEvent();
+ void ack();
Task * taskWaited() { return m_taskWaited; }
private:
Task * m_taskWaited;
+ bool m_ack;
+};
+
+class Async : public BaseEvent {
+ public:
+ Async() { m_evt.set<Async, &Async::evt_cb>(this); }
+ virtual ~Async() { m_evt.stop(); }
+ void trigger() { m_evt.send(); }
+ void evt_cb(ev::async & w, int revents) { doSignal(); }
+ protected:
+ virtual void gotOwner(Task * task);
+ private:
+ ev::async m_evt;
};
class Custom : public BaseEvent {