Skip to content

Commit

Permalink
Merge pull request hantmac#149 from whoisix/patch-2
Browse files Browse the repository at this point in the history
Update 10.7.2.md
  • Loading branch information
hantmac committed Apr 2, 2020
2 parents 581924c + 6a2e49b commit 0df167b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eBook/chapter10/10.7.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func main() {
finished <- true
}()
makeWP(nWorkers)
fmt.Println(": %v\n", <-finished)
fmt.Printf(": %v\n", <-finished)
}
```

Expand Down Expand Up @@ -160,4 +160,4 @@ ClientID: 14 int: 14 square:196

当您希望在 `main()` 函数中为每个单独的请求提供服务而不希望得到它的响应时,就像在 `workerpool.go` 中发生的那样,您需要担心的事情就很少了。在 `main()` 函数中既要使用 goroutines 处理请求,又要从它们获得响应,一个简单的办法是使用共享内存或者一个监视进程来搜集数据而不只是打印它们到屏幕上。

最后,`workerPool.go` 程序的工作是非常的简单,因为 `worker()` 函数不会失败。当您必须在计算机网络上工作或使用其他可能会失败的资源时,情况就不是这样了。
最后,`workerPool.go` 程序的工作是非常的简单,因为 `worker()` 函数不会失败。当您必须在计算机网络上工作或使用其他可能会失败的资源时,情况就不是这样了。

0 comments on commit 0df167b

Please sign in to comment.