#ifndef DEVICE_CTRL_THREAD_POOL_H
#define DEVICE_CTRL_THREAD_POOL_H
#include <thread>
#include <taskflow/core/executor.hpp>

namespace zsy::ThreadPool
{
    inline tf::Executor Exec(std::thread::hardware_concurrency() * 2);

    template<typename Callable>
    auto submit(Callable &&task) -> tf::Future<void>
    {
        tf::Taskflow tf;
        tf.emplace(std::forward<Callable>(task));
        return Exec.run(std::move(tf));
    }
}
#endif //DEVICE_CTRL_THREAD_POOL_H
