MCPcopy Create free account
hub / github.com/OpenMined/TenSEAL / enqueue_task

Method enqueue_task

tenseal/cpp/utils/threadpool.h:61–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 **/
60 template <typename F, typename... Args>
61 auto enqueue_task(F&& f, Args&&... args)
62 -> std::future<typename std::result_of<F(Args...)>::type> {
63 using return_type = typename std::result_of<F(Args...)>::type;
64
65 auto task = std::make_shared<std::packaged_task<return_type()>>(
66 std::bind(std::forward<F>(f), std::forward<Args>(args)...));
67 std::future<return_type> res = task->get_future();
68 auto work = [task]() { (*task)(); };
69
70 unsigned int i = m_index++;
71 m_queues[i % m_count].push(work);
72
73 return res;
74 }
75
76 private:
77 using Proc = std::function<void(void)>;

Callers 3

dispatch_jobsMethod · 0.80
dispatch_jobsMethod · 0.80

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected