From a6ab8f6362fa448a3325e74b2b663802d022d508 Mon Sep 17 00:00:00 2001 From: Jayesh Mann <36336898+jayeshmann@users.noreply.github.com> Date: Tue, 27 Apr 2021 01:39:21 +0530 Subject: [PATCH 1/2] Updated spawn implementation from documentation Check (std::thread::spawn)[https://doc.rust-lang.org/std/thread/fn.spawn.html] for reference. --- src/ch20-02-multithreaded.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ch20-02-multithreaded.md b/src/ch20-02-multithreaded.md index 24c7206979..8f6a6d5826 100644 --- a/src/ch20-02-multithreaded.md +++ b/src/ch20-02-multithreaded.md @@ -226,8 +226,9 @@ shows us the following: ```rust,ignore pub fn spawn(f: F) -> JoinHandle where - F: FnOnce() -> T + Send + 'static, - T: Send + 'static + F: FnOnce() -> T, + F: Send + 'static, + T: Send + 'static, ``` The `F` type parameter is the one we’re concerned with here; the `T` type From c2bc97eb6161e2c4c4213b2f3d311688ad16db5f Mon Sep 17 00:00:00 2001 From: Jayesh Mann Date: Tue, 27 Apr 2021 02:13:02 +0530 Subject: [PATCH 2/2] Another block --- src/ch20-02-multithreaded.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ch20-02-multithreaded.md b/src/ch20-02-multithreaded.md index 8f6a6d5826..244f8e53fb 100644 --- a/src/ch20-02-multithreaded.md +++ b/src/ch20-02-multithreaded.md @@ -322,8 +322,9 @@ the `thread::spawn` signature: ```rust,ignore pub fn spawn(f: F) -> JoinHandle where - F: FnOnce() -> T + Send + 'static, - T: Send + 'static + F: FnOnce() -> T, + F: Send + 'static, + T: Send + 'static, ``` The `spawn` function returns a `JoinHandle`, where `T` is the type that the