From e98b5438d342beb27961fcdcd0902eaf07ce6bf6 Mon Sep 17 00:00:00 2001 From: Daniil Mironenko Date: Mon, 16 Sep 2024 14:25:20 +0300 Subject: [PATCH] create functional style submit --- source/fiber/sched/task/submit.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 source/fiber/sched/task/submit.hpp diff --git a/source/fiber/sched/task/submit.hpp b/source/fiber/sched/task/submit.hpp new file mode 100644 index 0000000..7189668 --- /dev/null +++ b/source/fiber/sched/task/submit.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "scheduler.hpp" +#include "unique_function.hpp" + +#include + +namespace fiber::sched::task { + +template +void Submit(IScheduler& scheduler, F func) { + auto task = UniqueFunction::New(std::move(func)); + scheduler.Submit(task); +} + +} // namespace fiber::sched::task