MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / submit_task

Function submit_task

include/BS_thread_pool.hpp:1939–1944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1937 */
1938 template <typename F, typename R = std::invoke_result_t<std::decay_t<F>>>
1939 [[nodiscard]] std::future<R> submit_task(F&& task, const priority_t priority = 0)
1940 {
1941 task_and_future<R> ft(std::forward<F>(task));
1942 detach_task(std::move(ft.task), priority);
1943 return std::move(ft.future);
1944 }
1945
1946 /**
1947 * @brief Unpause the pool. The workers will resume retrieving new tasks out of the queue. Only enabled if the flag `BS::tp::pause` is enabled in the template parameter.

Callers

nothing calls this directly

Calls 1

detach_taskFunction · 0.85

Tested by

no test coverage detected