blob: c09fa8b03fadab548edecb3ce28b0ec001dc6bff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "task.hpp"
#include <functional>
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();
}
}
}
}
|