go
文章平均质量分 51
outsider0007
github:https://github.com/colin0000007
展开
-
超时的goroutine如何回收?
谈到goroutine并发超时控制,一搜很容易看到下面这样的代码。 func TestGoroutine3(t *testing.T) { done := make(chan struct{}, 0) go func() { // do something time.Sleep(time.Second) fmt.Println("server") done <- struct{}{} fmt.Println("send done success!") }() selec原创 2020-07-28 16:46:38 · 1283 阅读 · 0 评论 -
go语言context包源码解析
go语言context包源码解析 由于需要转go,学了基础和一些服务端框架后决定对go的一些源码进行阅读,并适当去实现。第一份源码就看了context,下面对context进行详细的解读。 ...原创 2019-11-24 15:02:17 · 506 阅读 · 0 评论