结构较好的货币
`conc'是用于结构化货币的工具带 更简单更安全
(原始内容存档于2019-09-29) (英语). ```sh go get github.com/sourcegraph/conc
{\fn方正粗倩简体\fs12\an8\1cHFFFF00\b0}看一眼
- 使用[`conc.waitGroup' (https://pkg.go.dev/github.com/sourcegraph/conc#WaitGroup),只要你想要一个更安全的`同步'版本。 等待组
- 使用[`pool.pool' (https://pkg.go.dev/github.com/sourcegraph/conc/pool#Pool),如果想要一个货币有限的任务执行者
- 使用[`池.ResultPool' (https://pkg.go.dev/github.com/sourcegraph/conc/pool#ResultPool),如果需要同时收集任务结果的任务执行者
- 使用[`集合.(结果)? ororPool' (ZZURL3Z),如果你的任务不可行
- 使用['池.(复出)? 上下文Pool' (https://pkg.go.dev/github.com/sourcegraph/conc/pool#ContextPool) 如果您失败, 任务将被取消
- 使用[`stream.stream' (https://pkg.go.dev/github.com/sourcegraph/conc/stream#Stream),如果您想同时处理顺序调用的任务
- 使用 [`iter.Map' (https://pkg.go.dev/github.com/sourcegraph/conc/iter#Map),如果你想同时映射一个切片
- 使用[`iter.ForEach' (https://pkg.go.dev/github.com/sourcegraph/conc/iter#ForEach),如果你想在一块地上同时使用
- 使用[`泛音. Catcher' (https://pkg.go.dev/github.com/sourcegraph/conc/panics#Catcher) 如果你想在自己的花花公子上抓住恐慌
所有池都是通过
[`集合.新()' (ZZURL9Z)
或者说
[`集合.NewWithResults[T] (https://pkg.go.dev/github.com/sourcegraph/conc/pool#NewWithResults)],
然后以方法配置 :
- [`p. with MaxGoroutines ()' (ZZURL11Z) 配置游泳池中最多的出行道数
- [`p. With Errors ()' (https://pkg.go.dev/github.com/sourcegraph/conc/pool#Pool.WithErrors) 配置池来运行返回出错的任务
- [`p. with Context(ctx)' (https://pkg.go.dev/github.com/sourcegraph/conc/pool#Pool.WithContext) 配置池以运行在第一次出错时应当取消的任务
- [`p. With First Error ()' (ZZURL14Z)在回调为空时, stream.Wait() 会发生崩溃
看起来最近一次提交是 1 年多以前的了。情况如何?
使用 `.WithErrors()` 后截取第一个错误后的结果
在 v0.3.0 之后,在上下文池中性能下降
如果未设置 max goroutine,则 conc/stream.Stream 将按顺序运行
功能请求: Daemon/Sidekick 池
使用自定义 go 池
在 `ErrorPool` 中,将错误存储为 `[]error` 而不是扁平化的 `error`
目标 #1 的可能修改示例
建议:可选结果