facebook / facebook/folly

Future interruption (raise, cancel) doesn't propagate through `collect`

未关闭
#1,237 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
30.5k
派生
5.9k
PR 合并指标
30 天内没有已合并 PR

描述

One would expect that interrupting the future resulting from `collect` would interrupt all the source futures, but this doesn't happen.

This prints 0, not 2:

```
int n = 0;

auto [p1, f1] = folly::makePromiseContract();
p1.setInterruptHandler([&](const folly::exception_wrapper& ew) { ++n; });

auto [p2, f2] = folly::makePromiseContract();
p2.setInterruptHandler([&](const folly::exception_wrapper& ew) { ++n; });

auto f = folly::collect(std::move(f1), std::move(f2));

f.cancel();

printf("%d\n", n);
```

Is there a better way to accomplish this?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。