diff options
author | Nao Pross <naopross@thearcway.org> | 2019-01-22 01:52:21 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-01-22 02:31:45 +0100 |
commit | c21f73c4501d4bb488a97b360003b7bbc4e24619 (patch) | |
tree | 745dc0890c334b2a160bda0b8b1fa917140013ce /engine/task.cpp | |
parent | Delete flatevolvable.h and flatevolvable.cpp (diff) | |
download | flatland-c21f73c4501d4bb488a97b360003b7bbc4e24619.tar.gz flatland-c21f73c4501d4bb488a97b360003b7bbc4e24619.zip |
Re-implement flattask.h in task.hpp
Note: On this commit NOTHING compiles.
Diffstat (limited to 'engine/task.cpp')
-rw-r--r-- | engine/task.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/task.cpp b/engine/task.cpp new file mode 100644 index 0000000..537a6b1 --- /dev/null +++ b/engine/task.cpp @@ -0,0 +1,23 @@ +#include "task.hpp" + +#include <functional> +#include <set> + + +namespace flat { + namespace core { + bool operator<(const task& lhs, const task& rhs) { + // task::priority::max is 0, a higher number is lower priority + return lhs.m_priority < rhs.m_priority; + } + + task::task(std::function<void()> callback, task::priority p) + : m_priority(p), m_callback(callback) {} + + void job::invoke_tasks() { + for (const task& t : *this) { + t(); + } + } + } +}
\ No newline at end of file |