summaryrefslogtreecommitdiff
path: root/src/task_runner.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/task_runner.hh')
-rw-r--r--src/task_runner.hh24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/task_runner.hh b/src/task_runner.hh
new file mode 100644
index 0000000..d1c79d6
--- /dev/null
+++ b/src/task_runner.hh
@@ -0,0 +1,24 @@
+#ifndef TASK_RUNNER_HH
+#define TASK_RUNNER_HH
+
+#include <functional>
+#include <memory>
+
+class Looper;
+
+class TaskRunner {
+public:
+ virtual ~TaskRunner() = default;
+
+ static std::unique_ptr<TaskRunner> create(std::shared_ptr<Looper> looper);
+ static std::unique_ptr<TaskRunner> create(size_t threads = 1);
+
+ virtual void post(std::function<void()> callback) = 0;
+
+protected:
+ TaskRunner() = default;
+ TaskRunner(TaskRunner const&) = delete;
+ TaskRunner& operator=(TaskRunner const&) = delete;
+};
+
+#endif // TASK_RUNNER_HH