summaryrefslogtreecommitdiff
path: root/includes/Task.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-10 19:36:55 -0700
committerPixel <pixel@nobis-crew.org>2011-10-10 19:36:55 -0700
commit965148b43b5b859934b7af2e8447ba1026a43a19 (patch)
tree290ff60cd1ebc9a065109620b2e9a5ff4e5b3d17 /includes/Task.h
parentcf9a801ebcb4df0a8b1ea75e58ca8ea8960ba13b (diff)
Adding the basic "Handle" structure, and adding an early version of Input.
Renamed suspend() to yield(). Fixed a couple of bugs, and reorganized slightly some code.
Diffstat (limited to 'includes/Task.h')
-rw-r--r--includes/Task.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/includes/Task.h b/includes/Task.h
index f0c1bbb..8a504c7 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -44,6 +44,15 @@ class TaskEvent : public BaseEvent {
Task * m_taskWaited;
};
+class Custom : public BaseEvent {
+ public:
+ void doSignal() { BaseEvent::doSignal(); ev_break(m_loop, EVBREAK_ALL); }
+ protected:
+ virtual void gotOwner(Task * task);
+ private:
+ struct ev_loop * m_loop;
+};
+
};
class Task {
@@ -60,9 +69,10 @@ class Task {
virtual const char * getName() = 0;
Status getStatus() { return m_status; }
static Task * getCurrentTask();
+ static void yield(Events::BaseEvent * evt) { Task * t = getCurrentTask(); t->waitFor(evt); t->yield(); }
TaskMan * getTaskMan() { return m_taskMan; }
protected:
- void suspend();
+ void yield();
virtual void Do() = 0;
void waitFor(Events::BaseEvent * event);
private: