MCPcopy Create free account
hub / github.com/KjellKod/g3log / ObsoleteSpawnTask

Function ObsoleteSpawnTask

test_unit/test_cpp_future_concepts.cpp:68–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67template <typename F>
68std::future<std::invoke_result_t<F>> ObsoleteSpawnTask(F f) {
69 typedef std::invoke_result_t<F> result_type;
70 typedef std::packaged_task<result_type()> task_type;
71
72 task_type task(std::move(f));
73 std::future<result_type> result = task.get_future();
74
75 std::vector<std::function<void()>> vec;
76 vec.push_back(g3::MoveOnCopy<task_type>(std::move(task)));
77 std::thread(std::move(vec.back())).detach();
78 result.wait();
79 return std::move(result);
80}
81
82TEST(TestOf_ObsoleteSpawnTaskWithStringReturn, Expecting_FutureString) {
83 std::string str("Hello");

Callers 1

TESTFunction · 0.85

Calls 1

get_futureMethod · 0.80

Tested by

no test coverage detected