Skip to content

Commit 1a4d1f7

Browse files
committed
Fix function name in book: thread_pool_destroy
Page 12 refers to `thread_pool_destroy`, but the actual function name used in the example code is `tpool_destroy`. This commit corrects the discrepancy to avoid confusion.
1 parent f35f108 commit 1a4d1f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

concurrency-primer.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ \subsection{example}
529529
\end{ccode}
530530

531531
\textbf{Exchange}
532-
In function \monobox{thread\_pool\_destroy}, \monobox{atomic\_exchange(\&thrd\_pool->state, cancelled)} reads the current state and replaces it with ``cancelled''.
532+
In function \monobox{tpool\_destroy}, \monobox{atomic\_exchange(\&thrd\_pool->state, cancelled)} reads the current state and replaces it with ``cancelled''.
533533
A warning message is printed if the pool is destroyed while workers are still ``running''.
534534
If the exchange is not performed atomically, we may initially get the state as ``running''. Subsequently, a thread could set the state to ``cancelled'' after finishing the last one, resulting in a false warning.
535535

@@ -541,7 +541,7 @@ \subsection{example}
541541
This indicates that the main thread will wail until the worker completes the job and returns ownership back to the main thread, which ensures correct cooperation.
542542

543543
\textbf{Fetch and…}
544-
In the function \monobox{thread\_pool\_destroy}, \monobox{atomic\_fetch\_and} is utilized as a means to set the state to ``idle''.
544+
In the function \monobox{tpool\_destroy}, \monobox{atomic\_fetch\_and} is utilized as a means to set the state to ``idle''.
545545
Yet, in this case, it is not necessary, as the pool needs to be reinitialized for further use regardless.
546546
Its return value could be further utilized, for instance, to report the previous state and perform additional actions.
547547

0 commit comments

Comments
 (0)