Skip to content

Commit

Permalink
create functional style submit
Browse files Browse the repository at this point in the history
  • Loading branch information
daronenko committed Sep 16, 2024
1 parent dff89ee commit e98b543
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions source/fiber/sched/task/submit.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include "scheduler.hpp"
#include "unique_function.hpp"

#include <cstdlib>

namespace fiber::sched::task {

template <typename F>
void Submit(IScheduler& scheduler, F func) {
auto task = UniqueFunction<F>::New(std::move(func));
scheduler.Submit(task);
}

} // namespace fiber::sched::task

0 comments on commit e98b543

Please sign in to comment.