随笔 - 14  文章 - 0  评论 - 1  阅读 - 13793
  2022年6月5日
摘要: import ( "fmt" "runtime" "sync" "time" ) // Pool Goroutine Pool type Pool struct { queue chan int wg *sync.WaitGroup } // New 新建一个协程池 func NewPool(siz 阅读全文
posted @ 2022-06-05 18:25 啊哈好223 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Golang 使用树形派生的方式构造 Context,通过在不同过程 [1] 中传递 deadline 和 cancel 信号,来管理处理某个任务所涉及到的一组 goroutine 的生命周期,防止 goroutine 泄露。并且可以通过附加在 Context 上的 Value 来传递/共享一些跨越 阅读全文
posted @ 2022-06-05 18:20 啊哈好223 阅读(173) 评论(0) 推荐(0) 编辑
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示