mirror of
https://github.com/gnu4cn/rust-lang-zh_CN.git
synced 2025-01-13 22:00:50 +08:00
Update Ch20 and optimize .gitignore
This commit is contained in:
parent
15e051b68c
commit
ae172f3770
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
book
|
||||
target
|
||||
Cargo.lock
|
||||
*.html
|
||||
|
@ -566,3 +566,13 @@ fn main() {
|
||||
```
|
||||
|
||||
*清单 20-11:为每个 TCP 流生成一个新线程*
|
||||
|
||||
如同咱们在第 16 章中所学到的,`thread::spawn` 讲创建出一个新线程,并于随后在新线程中,运行那个闭包中的代码。当咱们运行此代码,并在浏览器中加载 `/sleep`,随后在另外两个浏览器 Tab 页中加载 `/`,咱们就会看到到 `/` 的请求就不必等待 `/sleep` 请求完毕了。不过,如同咱们曾提到过的,因为咱们正不带任何限制地构造新线程,而最终将使系统不堪重负。
|
||||
|
||||
|
||||
#### 创建有限数目的线程
|
||||
|
||||
**Creating a Finite Number of Threads**
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user