Skip to content

Conversation

marty1885
Copy link
Member

This PR implements when_all. A new function to wait for multiple coroutines to finish. This function is designed to not suffer from head of line blocking when a coroutine takes particularly long to finish.

Before this PR, we write the following. Which forces the next request to be sent after reeving response from the server.

for(int i=0;i<10;i++)
{
    co_await client->sendRequestCoro(req);
}

With this PR, we can do the following, Which will queue all request into the client before waiting for all responses.

std::vector<Task<>> tasks;
for(int i=0;i<10;i++)
{
    tasks.push_back(client->sendRequestCoro(req));
}

co_await when_all(std::move(tasks));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant