Go 并发模式:Pipeline 与取消
大家好,我是江湖十年。
Go 官方博客在 2014 年发表过一篇介绍并发流水线的文章《Go Concurrency Patterns: Pipelines and cancellation》。文中通过逐步演进的示例,展示了如何用 channel 构建流式数据处理流水线,以及在操作失败、提前退出等场景下如何优雅地取消、避免 goroutine 泄漏。本文是对这篇文章的中文翻译。
阅读全文…