summaryrefslogtreecommitdiffstats
path: root/engine/include/core/task.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine/include/core/task.hpp')
-rw-r--r--engine/include/core/task.hpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/engine/include/core/task.hpp b/engine/include/core/task.hpp
index 9422a23..b6ddad1 100644
--- a/engine/include/core/task.hpp
+++ b/engine/include/core/task.hpp
@@ -1,34 +1,25 @@
#pragma once
+#include "priority.hpp"
+
#include <functional>
#include <set>
namespace flat {
namespace core {
- class task {
+ class task : public prioritized {
public:
- enum class priority : unsigned {
- max = 0,
- high = 1,
- none = 2,
- low = 3,
- min = 4,
- };
-
- // to pass a member function (method) use std::bind(f, obj)
- task(std::function<void()> callback, priority p = priority::none);
task() = delete;
+ task(std::function<void()> callback, priority_t p = priority_t::none);
inline void operator()() const { m_callback(); }
- friend bool operator<(const task& lhs, const task& rhs);
private:
- const priority m_priority;
std::function<void()> m_callback;
};
struct job : public std::multiset<task> {
- inline void add_task(task t) {
+ inline auto add_task(task t) {
this->insert(t);
}