Skip to content

Commit 8ef149b

Browse files
authored
Merge branch 'main' into docker_epoll
2 parents 29dbbe5 + f2c0fd0 commit 8ef149b

File tree

10 files changed

+23
-17
lines changed

10 files changed

+23
-17
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,16 @@ With the following software and hardware list you can run all code files present
4343
| 1-10 | Rust (version 1.51 or later) | Windows, macOS, or Linux |
4444

4545
## Errata
46-
* Page 58 (Paragraph 3, line 1): **create** _should be_ **crate**
47-
46+
* Page 58 (Paragraph 3, line 1): **create** _should be_ **crate**
47+
* Page 10 (Paragraph 8, line 3): **240 beers** _should be_ **180 beers**
48+
* Page 10 (Paragraph 9, line 1): **240 beers** _should be_ **180 beers**
49+
* Page 10 (Paragraph 9, line 4): **180 beers** _should be_ **170 beers**
50+
* Page 10 (Paragraph 10, line 1): **360 beers** _should be_ **340 beers**
51+
* Page 11 (Paragraph 2, line 2): **230 orders** _should be_ **175 orders**
52+
* Page 11 (Paragraph 2, line 3): **460 beers** _should be_ **350 beers**
53+
* Page 152 (Paragraph 3, line 1): **we** _should be_ **We**
54+
* Page 163 (Paragraph 4, line 2): **The next `coroutine/wait` function is `read_requests`** _should be_ **The next `coroutine/wait` function is `requests`**
55+
* Page 17 (Paragraph 3, line 2): **dye** _should be_ **die**
4856

4957
### Related products
5058
* Hands-On Concurrency with Rust [[Packt]](https://www.packtpub.com/product/hands-on-concurrency-with-rust/9781788399975) [[Amazon]](https://www.amazon.com/Hands-Concurrency-Rust-Confidently-memory-safe/dp/1788399978/ref=sr_1_1?crid=1S3COJO6XGV3Z&keywords=Hands-On+Concurrency+with+Rust&qid=1707141930&sprefix=hands-on+concurrency+with+rust%2Caps%2C291&sr=8-1)

ch01/a-assembly-dereference/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! ## FIX ISSUE #11:
55
//! See:https://github.com/PacktPublishing/Asynchronous-Programming-in-Rust/issues/11
66
//! The book didn't make it clear that this example will only work on `x86-64` architecture,
7-
//! so users on newer M-series macs (which uses the ARM64 instruciton set), will get a
7+
//! so users on newer M-series macs (which uses the ARM64 instruction set), will get a
88
//! compilation error. This is solved by conditionally compiling a version that works
99
//! with the ARM64 instruction set.
1010
@@ -20,7 +20,7 @@ fn main() {
2020
println!("{}", x);
2121
}
2222

23-
#[cfg(target_arch = "x86-64")]
23+
#[cfg(target_arch = "x86_64")]
2424
fn dereference(ptr: *const usize) -> usize {
2525
let mut res: usize;
2626
unsafe {

ch03/a-raw-syscall/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn syscall(message: String) {
5050
}
5151

5252
// ----------------------------------------------------------------------------
53-
// macOS raw syscall when running newer M familiy CPU (ARM 64 architecture)
53+
// macOS raw syscall when running newer M family CPU (ARM 64 architecture)
5454
// ----------------------------------------------------------------------------
5555

5656
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]

ch04/a-epoll/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ fn handle_events(
5252
match streams[index].read(&mut data) {
5353
Ok(n) if n == 0 => {
5454
// FIX #4
55-
// `insert` returns false if the value already existed in the set. We
56-
// handle it here since we must be sure that the TcpStream is fully
57-
// drained due to using edge triggered epoll.
55+
// `insert` returns false if the value already existed in the set.
5856
if !handled.insert(index) {
5957
break;
6058
}

ch04/a-epoll/src/poll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl Poll {
4545
return Err(io::Error::last_os_error());
4646
};
4747

48-
// This is safe because epol_wait ensures that `res` events are assigned.
48+
// This is safe because epoll_wait ensures that `res` events are assigned.
4949
unsafe { events.set_len(res as usize) };
5050
Ok(())
5151
}

ch04/b-epoll-mio/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ fn handle_events(events: &[Event], streams: &mut [TcpStream], handled: &mut Hash
5959
match streams[index].read(&mut data) {
6060
Ok(n) if n == 0 => {
6161
// FIX #4
62-
// `insert` returns false if the value already existed in the set. We
63-
// handle it here since we must be sure that the TcpStream is fully
64-
// drained due to using edge triggered epoll.
62+
// `insert` returns false if the value already existed in the set.
6563
if !handled.insert(index) {
6664
break;
6765
}

ch05/d-fibers-closure/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ unsafe fn switch() {
197197
);
198198
}
199199

200-
// The main function has aslo changed
200+
// The main function has also changed
201201
#[cfg(not(windows))]
202202
pub fn main() {
203203
let mut runtime = Runtime::new();

ch07/a-coroutine/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::{
22
thread,
33
time::Duration,
4+
Instant
45
};
56

67
mod future;

ch07/corofy/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl Future for Coroutine{id} {{
295295
// We need to special case the first call since that
296296
// happens before we reach an `await` point
297297

298-
// This will recieve the input args to the function
298+
// This will receive the input args to the function
299299
let impl_fut_first_args = format_args_names_only(&args);
300300

301301
if i == 0 {
@@ -332,7 +332,7 @@ impl Future for Coroutine{id} {{
332332
"
333333
)?;
334334

335-
// These steps are await-ponts where we await a future
335+
// These steps are await-points where we await a future
336336
} else if i < steps.len() - 1 {
337337
let varname = &futures[i - 1].0;
338338
let fut = &futures[i].1;

delayserver/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ use actix_web::{Responder, get, HttpServer, App, web, rt::time::sleep};
44
const EXPLANATION: &str =
55
"USAGE:
66
Delay server works by issuing a http GET request in the format:
7-
http://localhost:8080/[delay in ms]/[UrlEncoded meesage]
7+
http://localhost:8080/[delay in ms]/[UrlEncoded message]
88
99
If an argument is passed in when delayserver is started, that
1010
argument will be used as the url instead of 'localhost'
1111
12-
On reception, it immidiately reports the following to the console:
12+
On reception, it immieiately reports the following to the console:
13+
1314
{Message #} - {delay in ms}: {message}
1415
1516
The server then delays the response for the requested time and echoes the message back to the caller.

0 commit comments

Comments
 (0)