summaryrefslogtreecommitdiff
path: root/src/database/include/db_task.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-05-22 15:23:51 +1000
committerjacqueline <me@jacqueline.id.au>2023-05-22 15:23:51 +1000
commit5ac4d3949cd7430e0d4c994bbc528e8e4fa91337 (patch)
treedcd30c252e45afa20f084e1a58cbabd861ca299c /src/database/include/db_task.hpp
parentb320a6a863cf1c10dc79254af41f573730935564 (diff)
downloadtangara-fw-5ac4d3949cd7430e0d4c994bbc528e8e4fa91337.tar.gz
Generalise worker tasks, and centralise task priorities + stacks
Includes making the display driver use a worker task for flushes, so that our double buffering actually does something useful /facepalm
Diffstat (limited to 'src/database/include/db_task.hpp')
-rw-r--r--src/database/include/db_task.hpp25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/database/include/db_task.hpp b/src/database/include/db_task.hpp
deleted file mode 100644
index 39f932b0..00000000
--- a/src/database/include/db_task.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include <functional>
-#include <future>
-#include <memory>
-
-namespace database {
-
-auto StartDbTask() -> bool;
-auto QuitDbTask() -> void;
-
-auto SendToDbTask(std::function<void(void)> fn) -> void;
-
-template <typename T>
-auto RunOnDbTask(std::function<T(void)> fn) -> std::future<T> {
- std::shared_ptr<std::promise<T>> promise =
- std::make_shared<std::promise<T>>();
- SendToDbTask([=]() { promise->set_value(std::invoke(fn)); });
- return promise->get_future();
-}
-
-template <>
-auto RunOnDbTask(std::function<void(void)> fn) -> std::future<void>;
-
-} // namespace database