mirror of
https://github.com/boostorg/cobalt.git
synced 2026-01-19 04:02:16 +00:00
revert errornous commit of main.cpp
This commit is contained in:
@@ -1,22 +1,16 @@
|
||||
// Copyright (c) 2022 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/cobalt.hpp>
|
||||
#include <boost/cobalt/main.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
|
||||
namespace cobalt = boost::cobalt;
|
||||
|
||||
auto cobalt_task() -> cobalt::task<int>
|
||||
boost::cobalt::main co_main(int argc, char *argv[])
|
||||
{
|
||||
boost::asio::steady_timer tim{co_await boost::asio::this_coro::executor, std::chrono::milliseconds(50)};
|
||||
co_await tim.async_wait(boost::cobalt::use_op);
|
||||
|
||||
co_return 0;
|
||||
}
|
||||
|
||||
|
||||
cobalt::main co_main(int argc, char * argv[])
|
||||
{
|
||||
constexpr std::size_t nb = 10000000;
|
||||
|
||||
for (std::size_t i = 0;i <nb; ++i)
|
||||
{
|
||||
|
||||
co_await cobalt_task();
|
||||
}
|
||||
co_return 0;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ CO_TEST_CASE(variadic)
|
||||
co_await d2;
|
||||
|
||||
g.cancel();
|
||||
BOOST_CHECK_THROW(co_await g, boost::system::system_error);
|
||||
try { BOOST_CHECK_THROW(co_await g, boost::system::system_error); }
|
||||
catch (boost::system::system_error &) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user