我正在使用context.Context来控制多个goroutine。goroutine监听context.Done(),然后立即打印日期字符串。该进程监听syscall.SIGHUP,它取消上下文,然后使用之前创建的上下文创建新的goroutine。 我认为当syscall.SIGHUP发出时,进程将打印一个日期字符串,但得到了两个。case <-sg: go printDate(ctx)
这是来自golang上下文页的代码片段。func httpDo(ctx context.Context, req *http.Request, f func(*http.Response, error) error) error {// Run the HTTP request in a goroutine and pass the response to f.并在一个新的goroutine中处理它的响应。如果ctx.Done在gorouti