From 6232d13f5321b87ddf12a1aa36b4545da45f173d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 17 Nov 2021 22:34:57 +0100 Subject: Travel3: Simple image and video display site Reads the images and videos from filesystem and builds a site in memroy. --- src/task_runner_reply.hh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/task_runner_reply.hh (limited to 'src/task_runner_reply.hh') diff --git a/src/task_runner_reply.hh b/src/task_runner_reply.hh new file mode 100644 index 0000000..1ca65a0 --- /dev/null +++ b/src/task_runner_reply.hh @@ -0,0 +1,19 @@ +#ifndef TASK_RUNNER_REPLY_HH +#define TASK_RUNNER_REPLY_HH + +#include "task_runner.hh" + +#include + +template +void post_and_reply(TaskRunner* callback_runner, + std::function callback, + std::shared_ptr reply_runner, + std::function reply) { + callback_runner->post([callback, reply, reply_runner] () { + auto r = callback(); + reply_runner->post(std::bind(std::move(reply), std::move(r))); + }); +} + +#endif // TASK_RUNNER_REPLY_HH -- cgit v1.2.3-70-g09d2