@@ -318,7 +318,8 @@ \section{Enforcing law and order}
318318int v = 0;
319319atomic_bool v_ready = false;
320320
321- void *threadA() {
321+ void *threadA()
322+ {
322323 v = 42;
323324 v_ready = true;
324325}
@@ -328,7 +329,8 @@ \section{Enforcing law and order}
328329\begin {minted }[fontsize=\codesize ]{c}
329330int bv;
330331
331- void *threadB() {
332+ void *threadB()
333+ {
332334 while(!v_ready) { /* wait */ }
333335 bv = v;
334336 /* Do something */
@@ -373,7 +375,7 @@ \section{Atomicity}
373375just make sure that any variables used for thread synchronization
374376are no larger than the \textsc {cpu} word size.
375377
376- \section {Arbitrarily-sized “ atomic” types }
378+ \section {Arbitrarily-sized `` atomic'' types }
377379
378380Along with \texttt {atomic\_ int } and friends,
379381\cplusplus {} provides the template \texttt {std::atomic<T> } for defining arbitrary atomic types.
@@ -398,8 +400,7 @@ \section{Arbitrarily-sized “atomic” types}
398400Consequently, \cplusplus {17} added \texttt {is\_ always\_ lock\_ free }:
399401\begin {colfigure }
400402\begin {minted }[fontsize=\codesize ]{cpp}
401- static_assert(
402- std::atomic<Foo>::is_always_lock_free);
403+ static_assert(std::atomic<Foo>::is_always_lock_free);
403404\end {minted }
404405\end {colfigure }
405406
@@ -453,10 +454,10 @@ \subsection{Test and set}
453454void unlock() { atomic_flag_clear(&af); }
454455\end {minted }
455456\end {colfigure }
456- If we call \mintinline {cpp }{lock()} and the previous value is \mintinline {cpp }{false},
457+ If we call \mintinline {c }{lock()} and the previous value is \mintinline {c }{false},
457458we are the first to acquire the lock,
458459and can proceed with exclusive access to whatever the lock protects.
459- If the previous value is \mintinline {cpp }{true},
460+ If the previous value is \mintinline {c }{true},
460461someone else has acquired the lock and we must wait until they release it by clearing the flag.
461462
462463\subsection {Fetch and… }
@@ -636,7 +637,7 @@ \section{Sequential consistency on weakly-ordered hardware}
636637\begin {minted }[fontsize=\codesize ]{cpp}
637638void setFoo(int i)
638639{
639- foo = i;
640+ foo = i;
640641}
641642\end {minted }
642643\end {minipage }
@@ -1344,7 +1345,7 @@ \section{Additional Resources}
13441345\textsc {n}4455}, and as a
13451346\href {https://www.youtube.com/watch?v=IB57wIf9W1k}{CppCon talk}.
13461347
1347- \href {http ://en.cppreference.com}{cppreference.com},
1348+ \href {https ://en.cppreference.com}{cppreference.com},
13481349an excellent reference for the \clang {} and \cplusplus {} memory model and atomic \textsc {api}.
13491350
13501351\href {https://godbolt.org/}{Matt Godbolt's Compiler Explorer},
0 commit comments