摘要: func MulProduction() { concurrency := make(chan struct{}, 100) //控制最大协程数 wg := sync.WaitGroup{} defer close(concurrency) for id := 0; id < 100; id++ { 阅读全文
posted @ 2023-08-01 10:53 知道了呀~ 阅读(19) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "sync" ) type Producer struct { ID int DataStream chan int WaitGroup *sync.WaitGroup } func (p *Producer) Produce(concurre 阅读全文
posted @ 2023-08-01 10:34 知道了呀~ 阅读(31) 评论(0) 推荐(0) 编辑