Skip to content

Coroutine set #3

Open
Open
@wiluite

Description

@wiluite

Thanks for the coroutine set.

The evolution of samples from the first one(02.10) to the result is awesome and produces the expected results.
However, what if one would use it from the perspective to write something more generic:

For example the data for "sending coroutine" could be just:

    std::vector<byte> fakeBytes {
        'H'_B, 'e'_B, 'l'_B, 'l'_B, 'o'_B
    };

and the code in "parsing coroutine" is co-awaiting and just co-yielding (echoing):

    while (true) {
        byte b = co_await byte{};
        std::string frame{};
        frame.push_back(static_cast<char>(b));
        co_yield frame;
    }

And in this sense the modified (02.10) keeps working as expected, but already the next one doesn't (is crashed).
Of course, things were done with an eye to a specific version of the protocol, the outcomes in common seem not functionally equivalent. And I thought that the issues could be interesting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions