You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/03/08 08:30:41 UTC

[GitHub] [nifi-minifi-cpp] dam4rus commented on a change in pull request #1022: Refactor ThreadPool::execute to return a future since it always retur…

dam4rus commented on a change in pull request #1022:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1022#discussion_r589245421



##########
File path: libminifi/test/unit/ThreadPoolTests.cpp
##########
@@ -70,8 +70,7 @@ TEST_CASE("ThreadPoolTest1", "[TPT1]") {
   std::function<bool()> f_ex = function;
   utils::Worker<bool> functor(f_ex, "id");
   pool.start();
-  std::future<bool> fut;
-  REQUIRE(true == pool.execute(std::move(functor), fut));
+  auto fut = pool.execute(std::move(functor));
   fut.wait();

Review comment:
       I'm not sure about whether it makes sense to test for validity or not to be honest. Judging by the documentation https://en.cppreference.com/w/cpp/thread/future/valid `std::future::valid` only returns `false` if `std::future::get` has been called. I can revert the assertion but I assume it would be always `true`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org