Skip to content

Commit

Permalink
added completion to spawn in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
klemens-morgenstern committed Jul 2, 2024
1 parent c2589b1 commit a833a06
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion test/v1/async_system_stackful.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <boost/process/v1/async_system.hpp>

#include <string>
#include <boost/asio/detached.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/spawn.hpp>
Expand Down Expand Up @@ -48,7 +49,7 @@ BOOST_AUTO_TEST_CASE(stackful, *boost::unit_test::timeout(15))
};

boost::asio::io_context::strand str{ios};
boost::asio::post(str, [&]{boost::asio::spawn(ios, stackful);});
boost::asio::post(str, [&]{boost::asio::spawn(ios, stackful, boost::asio::detached);});
boost::asio::post(str, [&]{did_something_else = true;});

ios.run();
Expand Down
7 changes: 4 additions & 3 deletions test/v1/async_system_stackful_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <boost/process/v1/async_system.hpp>

#include <string>
#include <boost/asio/detached.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/spawn.hpp>
Expand Down Expand Up @@ -46,7 +47,7 @@ BOOST_AUTO_TEST_CASE(stackful, *boost::unit_test::timeout(15))
BOOST_CHECK(did_something_else);
};

boost::asio::spawn(ios, stackful);
boost::asio::spawn(ios, stackful, boost::asio::detached);
boost::asio::post(ios.get_executor(), [&]{did_something_else = true;});

ios.run();
Expand All @@ -72,7 +73,7 @@ BOOST_AUTO_TEST_CASE(stackful_except, *boost::unit_test::timeout(15))
BOOST_CHECK(did_something_else);
};

boost::asio::spawn(ios, stackful);
boost::asio::spawn(ios, stackful, boost::asio::detached);
boost::asio::post(ios.get_executor(), [&]{did_something_else = true;});
ios.run();

Expand Down Expand Up @@ -101,7 +102,7 @@ BOOST_AUTO_TEST_CASE(stackful_error, *boost::unit_test::timeout(15))
BOOST_CHECK(did_something_else);
};

boost::asio::spawn(ios, stackful);
boost::asio::spawn(ios, stackful, boost::asio::detached);
boost::asio::post(ios.get_executor(), [&]{did_something_else = true;});
ios.run();

Expand Down
3 changes: 2 additions & 1 deletion test/v1/async_system_stackful_except.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <boost/process/v1/async_system.hpp>

#include <string>
#include <boost/asio/detached.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/spawn.hpp>
Expand Down Expand Up @@ -45,7 +46,7 @@ BOOST_AUTO_TEST_CASE(stackful_except, *boost::unit_test::timeout(15))
BOOST_CHECK(did_something_else);
};

boost::asio::spawn(ios, stackful);
boost::asio::spawn(ios, stackful, boost::asio::detached);
boost::asio::post(ios.get_executor(), [&]{did_something_else = true;});
ios.run();

Expand Down

0 comments on commit a833a06

Please sign in to comment.