X Tutup
The Wayback Machine - https://web.archive.org/web/20200606100731/https://github.com/lewissbaker/cppcoro/issues/116
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async_generator example in README #116

Open
Quuxplusone opened this issue Jul 4, 2019 · 0 comments
Open

async_generator example in README #116

Quuxplusone opened this issue Jul 4, 2019 · 0 comments

Comments

@Quuxplusone
Copy link

@Quuxplusone Quuxplusone commented Jul 4, 2019

https://github.com/lewissbaker/cppcoro#async_generatort
uses some type called "threadpool" with a member function named "delay". Even if the type were supposed to be cppcoro::static_thread_pool, static_thread_pool still doesn't have any member named "delay".

The example at the moment is:

cppcoro::async_generator<int> ticker(int count, threadpool& tp)
{
  for (int i = 0; i < count; ++i)
  {
    co_await tp.delay(std::chrono::seconds(1));
    co_yield i;
  }
}

cppcoro::task<> consumer(threadpool& tp)
{
  auto sequence = ticker(10, tp);
  for co_await(std::uint32_t i : sequence)
  {
    std::cout << "Tick " << i << std::endl;
  }
}

It would be nice if the example were modified (hopefully just slightly?) to be compileable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.
X Tutup