-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19f8487
commit 210dce3
Showing
4 changed files
with
26 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
// 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; | ||
|
||
boost::cobalt::main co_main(int argc, char *argv[]) | ||
auto cobalt_task() -> cobalt::task<int> | ||
{ | ||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters