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

[v23.3.x] Implement async_for_each #16682

Merged

Commits on Feb 22, 2024

  1. Implement async_for_each

    Same as std::for_each, but which yields periodically. Written in a
    style which keeps in inner loop fast, equivalent to the non-async
    version (optimizer willing, but seems to be true in the case I
    checked).
    
    For the simplest use cases we offer async_for_each, which
    is the same as std::for_each except that it yields every
    Traits::Interval iterations: every call starts the "work counter" anew.
    
    For more complicated cases, like nested loops, it may be convenient to
    carry the counter from one iteration to the next, in order to yield at
    the correct times. For example, in a doubly nested loop where the inner
    loop always ran for less than Interval iterations, we would not yield
    with the simple functions.
    
    Issue redpanda-data/core-internal#1061.
    
    (cherry picked from commit a4c6b64)
    travisdowns committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    ad40a8a View commit details
    Browse the repository at this point in the history
  2. Tests for async_for_each

    (cherry picked from commit e602960)
    travisdowns committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    53097f5 View commit details
    Browse the repository at this point in the history