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

Request, create empty promise object that can be set later outside of a coroutine. #203

Open
sandercm opened this issue Sep 23, 2024 · 1 comment

Comments

@sandercm
Copy link

sandercm commented Sep 23, 2024

Hi,

I was wondering if it would be possible to add a method that would set a coroutine object from the "outside".
For example

boost::cobalt::promise<std::string> request;
// save the promise somewhere in a data struct
// ....
// recieve some network data
// match it with a request
request.set(data);

this would then resume any coroutine that is currently co_awaited on this promise. I found a way around this by using async channels but was wondering if it would be at all possible to do this without them?

@klemens-morgenstern
Copy link
Collaborator

It is not, that's what channels are for.

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

No branches or pull requests

2 participants