You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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; }
The text was updated successfully, but these errors were encountered: