# 10.3 goroutine超时检查的两种方式

这节介绍两个非常重要的技巧来帮助您处理 goroutines 超时。简单说，这两个技巧帮您解决不得不一直等待一个 goroutine 完成它的工作，并且让您完全控制等待 goroutine 结束的时间。这两个技巧都使用方便的 `select` 关键字的功能并结合上节中使用过的 `time.After()` 函数。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wskdsgcf.gitbook.io/mastering-go-zh-cn/10.0/10.3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
