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

Is waiting on a already completed future a wait failure? #802

Closed
rdhananjaya opened this issue Apr 1, 2021 · 3 comments
Closed

Is waiting on a already completed future a wait failure? #802

rdhananjaya opened this issue Apr 1, 2021 · 3 comments

Comments

@rdhananjaya
Copy link
Member

rdhananjaya commented Apr 1, 2021

Description:
I'm trying to understand how a wait can fail.

Is waiting on an already completed future a wait failure? If so, how can a user differenciate an error due to a wait failure vs future returning a error value.

Suggested Labels:

Code sample that shows issue:

Related Issues:

@jclark
Copy link
Collaborator

jclark commented Apr 1, 2021

Is waiting on an already completed future a wait failure?

Yes: that's what the bit you quoted from 7.3.2 says "Only one wait on a strand can succeed; this wait receives the value returned by the strand. Any other waits on that strand fail."

If so, how can a user differenciate an error due to a wait failure vs future returning a error value.

See #689.

@riyafa
Copy link

riyafa commented May 13, 2021

For this in the case of alternate wait action should the following return an error for the result of r1 because we try to wait on f4 twice?

    future<int|error> f1 = start calculate(3, 4);
    future<int|error> f4 = start calculate(9, 8);
    future<int|error> f5 = start calculate(5, 4);
    int|error result = wait f4|f5;
    int|error r1 = wait f4|f1;
    if(r1 is error) {
        panic r1;
    }

@jclark
Copy link
Collaborator

jclark commented May 13, 2021

@riyafa Let's make this a separate issue

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

3 participants