Errata

Rust Atomics and Locks

Errata for Rust Atomics and Locks

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page Chapter 1, "undefined behavior"
6th paragraph?

The paragraph starts with "This mean that in this code snippet", however, I believe it should read "This means that in this code snippet". (mean -> means)

Note from the Author or Editor:
Fixed!

Anonymous  Dec 31, 2022  Jan 27, 2023
Printed, PDF, ePub,
Page Page 68,
second last paragraph, starting with

In the explanation of the fence example with three loads and stores, the order of the happens-before relationship was accidentally reversed.

Instead of

"[..], the acquire fence on thread 2 happens-before the release fence on thread 1."

it should say:

"[..], the release fence on thread 1 happens-before the acquire fence on thread 2."

Mara Bos
 
Jan 06, 2023  Jan 27, 2023
Page Chapter 3, "Happens-Before Relationship"
4th paragraph

"let's take a look the following" -> "let's take a look at the following"

Note from the Author or Editor:
Fixed!

Anonymous  Jan 08, 2023  Jan 27, 2023
Page Chapter 3 (Release and Acquire Ordering)
4th paragraph

"we send an 64-bit integer from a spawned thread"

Looking at the example where an AtomicU64 is used I believe the text may have been written as "an unsigned 64-bit", but "an" should have been changed to "a" with the removal of unsigned.

Note from the Author or Editor:
Fixed!

Anonymous  Jan 15, 2023  Jan 27, 2023
Page Chapter 3 (Compiler Fences)
3rd paragraph

double the.
"on Linux through the the membarrier syscall"

Note from the Author or Editor:
Fixed!

Anonymous  Jan 25, 2023  Jan 27, 2023
Page Chapter 4 (A Minimal Implementation)
Tip

missing word.

"In general, it’s good idea" => "In general, it's a good idea"

Note from the Author or Editor:
Fixed!

Anonymous  Feb 09, 2023 
Printed, PDF, ePub, Mobi,
Page Chapters 4 and 9
The lock guard

In Chapters 4 and 9, the Sync implementation of the (Mutex)Guard is missing:

unsafe impl<T> Sync for Guard<'_, T> where T: Sync {}

Without this bound on Sync, the Guard could be shared between threads even when T is not Sync.

Mara Bos
 
Mar 06, 2023 
Page page 209
2nd code block

The assert checks that s != u32::MAX - 2, but it is called when s is even. Given that u32::MAX - 2 is odd, the assert won't fire when the max number of readers is reached.

Note from the Author or Editor:
The != operator should instead be a < operator.

Fixed!

Lucas Trzesniewski  Mar 18, 2023 
Page p.54
Code example under diagram

Code example on p.54 is repeated from p.53

Note from the Author or Editor:
This was fixed in the second print.

David Drysdale  Mar 18, 2023 
Page p.135
Paragraph 5 line 2

Reword "it's be possible" to "it's possible" or "it can be possible"

Note from the Author or Editor:
Fixed!

David Drysdale  Mar 28, 2023 
Page p179
Bullet 8

"In addition to pthread" => "In addition to pthreads" (add s)

Note from the Author or Editor:
Fixed!

David Drysdale  Mar 28, 2023 
Page p.197
Line 2

Change "contrtast" to "contrast"

Note from the Author or Editor:
Fixed!

David Drysdale  Mar 28, 2023 
Page 7
the last paragraph of "The Leakpocalypse" text box

Instead of "Only much later, in Rust 1.63, a new std::thread::scoped function was added" it should say "Only much later, in Rust 1.63, a new std::thread::scope function was added".

Note from the Author or Editor:
Fixed!

Vadim Kaushan  Jan 07, 2023  Jan 27, 2023
Page 38
Bullet point 7

“Scoped threads are useful to limit the lifetime of a thread to alllow it to borrow non-'static data, such as local variables.

alllow -> allow

Note from the Author or Editor:
Fixed!

Martin Junghanns  Feb 25, 2023 
Printed, PDF, ePub,
Page 76 (Chapter 4)
The note in "A Minimal Implementation"

is_ok() should be is_err() when used as the loop condition.

Mara Bos
 
Jan 17, 2023  Jan 27, 2023
Page 119
Center, second text paragraph

The sentence "The arc::new function ..." has an error: "..., initializing both counters at one like before..."

Here 'one' must be 'once'.

Note from the Author or Editor:
Fixed!

Kris van Rens   Apr 26, 2023