MCPcopy Create free account
hub / github.com/comaps/comaps / Submit

Method Submit

libs/base/thread_pool_computational.hpp:63–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 // Warning: If the thread pool is stopped then the call will be ignored.
62 template <typename F, typename... Args>
63 auto Submit(F && func, Args &&... args) -> std::future<decltype(func(args...))>
64 {
65 using ResultType = decltype(func(args...));
66 std::packaged_task<ResultType()> task(std::bind(std::forward<F>(func), std::forward<Args>(args)...));
67 std::future<ResultType> result(task.get_future());
68 {
69 std::unique_lock lock(m_mutex);
70 if (m_done)
71 return {};
72
73 m_queue.emplace(std::move(task));
74 }
75 m_condition.notify_one();
76 return result;
77 }
78
79 // Submit work for execution.
80 // func - task to be performed.

Callers 6

GetAffiliationsFunction · 0.80
DumpMethod · 0.80
FilterMethod · 0.80
FinishMethod · 0.80
UNIT_TESTFunction · 0.80
ProcessTaskAsyncMethod · 0.80

Calls 1

emplaceMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.64