diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Task.h | 6 | ||||
-rw-r--r-- | includes/TaskMan.h | 4 | ||||
-rw-r--r-- | includes/Threads.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/includes/Task.h b/includes/Task.h index 5865831..2e52747 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -5,7 +5,7 @@ #include <coro.h> #endif #include <ev++.h> -#include <vector> +#include <list> #include <Exceptions.h> #include <Printer.h> @@ -136,7 +136,7 @@ class Task { TaskMan * getMyTaskMan() { return m_taskMan; } private: static size_t stackSize() { return 64 * 1024; } - void setup(TaskMan * taskMan); + void setup(TaskMan * taskMan, void * stack); static bool needsStacks(); void switchTo(); static void CALLBACK coroutineTrampoline(void *); @@ -152,7 +152,7 @@ class Task { void * m_tls; friend class TaskMan; friend class Events::TaskEvent; - typedef std::vector<Events::TaskEvent *> waitedByList_t; + typedef std::list<Events::TaskEvent *> waitedByList_t; waitedByList_t m_waitedBy; bool m_okayToEAgain; }; diff --git a/includes/TaskMan.h b/includes/TaskMan.h index b944f09..c63695a 100644 --- a/includes/TaskMan.h +++ b/includes/TaskMan.h @@ -6,7 +6,7 @@ #endif #include <ev++.h> #include <ext/hash_set> -#include <vector> +#include <queue> #include <Threads.h> #include <Exceptions.h> @@ -55,6 +55,8 @@ class TaskMan { struct ev_loop * m_loop; bool m_allowedToSignal; ev::async m_evt; + std::queue<void *> m_stacks; + int m_nStacks; }; template<class T> diff --git a/includes/Threads.h b/includes/Threads.h index a1f270e..256e8e3 100644 --- a/includes/Threads.h +++ b/includes/Threads.h @@ -41,7 +41,7 @@ template<class T> class Queue { public: Queue() { pthread_cond_init(&m_cond, NULL); } - ~Queue() { pthread_cond_destroy(&m_cond); } + ~Queue() { while (size()) pop(); pthread_cond_destroy(&m_cond); } void push(T & t) { m_lock.enter(); m_queue.push(t); |