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

First page of tutorial should start with how ordering guarantees work #97

Open
ned14 opened this issue Aug 27, 2015 · 0 comments
Open

Comments

@ned14
Copy link
Member

ned14 commented Aug 27, 2015

With examples of acquire-release and seq_cst.

With examples of ordering in response to errors e.g.

In the sequence:

auto a=async_file();
auto b=async_read(a);
auto c=async_truncate(b);
auto d=async_rmfile(c);
auto e=async_close(d);

... you are explicitly saying do not execute later steps if an earlier step fails. It defaults to this as this is probably safest and least surprising.

If on the other hand you DO always want to delete and close the file no matter what happened before you would write:

auto a=async_file();
auto b=async_read(a);
auto c=async_truncate(b);
auto d=async_rmfile(depends(c, a));
auto e=async_close(d);

The depends(precondition, input) function swaps the second future for the first when the first completes. It is implemented as:

precondition.then([input](future &&f) { return input; }

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

No branches or pull requests

1 participant