mirror of
https://github.com/rust-lang/book.git
synced 2026-12-01 04:38:03 -06:00
Merge pull request #1532 from romusz/proman-18091615-fix-ch20-03-graceful-shutdown-and-cleanup
Fix ch20-03-graceful-shutdown-and-cleanup
This commit is contained in:
@@ -59,7 +59,7 @@ The error tells us we can’t call `join` because we only have a mutable borrow
|
||||
of each `worker` and `join` takes ownership of its argument. To solve this
|
||||
issue, we need to move the thread out of the `Worker` instance that owns
|
||||
`thread` so `join` can consume the thread. We did this in Listing 17-15: if
|
||||
`Worker` holds an `Option<thread::JoinHandle<()>` instead, we can call the
|
||||
`Worker` holds an `Option<thread::JoinHandle<()>>` instead, we can call the
|
||||
`take` method on the `Option` to move the value out of the `Some` variant and
|
||||
leave a `None` variant in its place. In other words, a `Worker` that is running
|
||||
will have a `Some` variant in `thread`, and when we want to clean up a
|
||||
|
||||
@@ -59,7 +59,7 @@ The error tells us we can’t call `join` because we only have a mutable borrow
|
||||
of each `worker` and `join` takes ownership of its argument. To solve this
|
||||
issue, we need to move the thread out of the `Worker` instance that owns
|
||||
`thread` so `join` can consume the thread. We did this in Listing 17-15: if
|
||||
`Worker` holds an `Option<thread::JoinHandle<()>` instead, we can call the
|
||||
`Worker` holds an `Option<thread::JoinHandle<()>>` instead, we can call the
|
||||
`take` method on the `Option` to move the value out of the `Some` variant and
|
||||
leave a `None` variant in its place. In other words, a `Worker` that is running
|
||||
will have a `Some` variant in `thread`, and when we want to clean up a
|
||||
|
||||
Reference in New Issue
Block a user