首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
[GO]go使用contextCancel
】的更多相关文章
[GO]go使用contextCancel
package main import ( "fmt" "context" ) func main() { gen := func(ctx context.Context) <-chan int { dst := make(chan int) n := go func() { for { select { case <-ctx.Done(): return // returning not to leak the goroutine case dst &…