记录 golang context
Opened this issue · 0 comments
an00 commented
https://blog.an00.cn/2021/10/16/%E8%AE%B0%E5%BD%95-golang-context/
记录 golang context有四种 context.WithCancel 可取消的context context.WithDeadline 在某时间结束的context context.WithTimeout(context.Background(), 2 * time.Second) 设置超时的context,也返回 ctx 和 cancel,可以等待自动超时,也可以提前执行ca