Skip to contentSkip to conversation

count: Adjust index marker of _Thread_local

PATCH Applied Akira Yokosawa 3 participants 3 messages Aug 24, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 count: Adjust index marker of _Thread_local

\apic{} is there for ISO C std APIs. Use it.

While we are here, fix a couple of minor nits:
- align //\lnlbl{var:b} in count_end.c;
- not line-break in front of \footnote{}, indent footnote text.

Fixes 24e8f711d2cf ("count: Switch from GCC to C11 thread-local storage")
Cc Elad Lahav <[email protected]>
---
 CodeSamples/count/count_end.c |  2 +-
 count/count.tex               | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
CodeSamples/count/count_end.c +1 -1
index 5e7b9ee1025c..b6ed851c35a9 100644
@@ -23,7 +23,7 @@
 #include "../api.h"
 
 //\begin{snippet}[labelbase=ln:count:count_end:whole,commandchars=\\\@\$]
-unsigned long _Thread_local counter = 0;		//\lnlbl{var:b}
+unsigned long _Thread_local counter = 0;	//\lnlbl{var:b}
 unsigned long *counterp[NR_THREADS] = { NULL };
 unsigned long finalcount = 0;
 DEFINE_SPINLOCK(final_mutex);			//\lnlbl{var:e}
count/count.tex +6 -6
index 775cf77e90a8..b2de4646b18f 100644
@@ -721,12 +721,12 @@ This is the topic of the next section.
 \subsection{Per-Thread-Variable-Based Implementation}
 \label{sec:count:Per-Thread-Variable-Based Implementation}
 
-The C language, since C11, features a \apig{_Thread_local} storage class that
-provides per-thread storage.
-\footnote{\GCC\ provides its own \apig{__thread} storage class, which was used
-in previous versions of this book.
-The two methods for specifying a thread-local variable are interchangeable
-when using \GCC\@.}
+The C language, since C11, features a \apic{_Thread_local} storage class that
+provides per-thread storage.\footnote{
+	\GCC\ provides its own \apig{__thread} storage class, which was used
+	in previous versions of this book.
+	The two methods for specifying a thread-local variable are
+	interchangeable when using \GCC\@.}
 This can be used as shown in
 \cref{lst:count:Per-Thread Statistical Counters} (\path{count_end.c})
 to implement

base-commit: ba01403b34de88d3060e119f899f5eb053c5f162

Signature · 1 line
2.25.1
#1 lore raw

Ah, yes, I was wondering what apig was. Now I get it. Thanks, Akira.

--Elad

Quoted 56 lines · Akira Yokosawa

\apic{} is there for ISO C std APIs. Use it.

While we are here, fix a couple of minor nits:
- align //\lnlbl{var:b} in count_end.c;
- not line-break in front of \footnote{}, indent footnote text.

Fixes 24e8f711d2cf ("count: Switch from GCC to C11 thread-local storage")
Cc Elad Lahav <[email protected]>
---
 CodeSamples/count/count_end.c |  2 +-
 count/count.tex               | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
CodeSamples/count/count_end.c +1 -1
index 5e7b9ee1025c..b6ed851c35a9 100644
@@ -23,7 +23,7 @@
 #include "../api.h"
 
 //\begin{snippet}[labelbase=ln:count:count_end:whole,commandchars=\\\@\$]
-unsigned long _Thread_local counter = 0;               //\lnlbl{var:b}
+unsigned long _Thread_local counter = 0;       //\lnlbl{var:b}
 unsigned long *counterp[NR_THREADS] = { NULL };
 unsigned long finalcount = 0;
 DEFINE_SPINLOCK(final_mutex);                  //\lnlbl{var:e}
count/count.tex +6 -6
index 775cf77e90a8..b2de4646b18f 100644
@@ -721,12 +721,12 @@ This is the topic of the next section.
 \subsection{Per-Thread-Variable-Based Implementation}
 \label{sec:count:Per-Thread-Variable-Based Implementation}
 
-The C language, since C11, features a \apig{_Thread_local} storage class that
-provides per-thread storage.
-\footnote{\GCC\ provides its own \apig{__thread} storage class, which was used
-in previous versions of this book.
-The two methods for specifying a thread-local variable are interchangeable
-when using \GCC\@.}
+The C language, since C11, features a \apic{_Thread_local} storage class that
+provides per-thread storage.\footnote{
+       \GCC\ provides its own \apig{__thread} storage class, which was used
+       in previous versions of this book.
+       The two methods for specifying a thread-local variable are
+       interchangeable when using \GCC\@.}
 This can be used as shown in
 \cref{lst:count:Per-Thread Statistical Counters} (\path{count_end.c})
 to implement

base-commit: ba01403b34de88d3060e119f899f5eb053c5f162 --
2.25.1

#2 lore raw
Quoted 16 lines · Elad Lahav

Ah, yes, I was wondering what apig was. Now I get it. Thanks, Akira.

--Elad

Quoted 10 lines · Akira Yokosawa

\apic{} is there for ISO C std APIs. Use it.

While we are here, fix a couple of minor nits:
- align //\lnlbl{var:b} in count_end.c;
- not line-break in front of \footnote{}, indent footnote text.

Fixes 24e8f711d2cf ("count: Switch from GCC to C11 thread-local storage")
Cc Elad Lahav <[email protected]>

Queued and pushed, thank you both!

Just to set expectations, I anticipate taking GCC-to-C11 changes on a case-by-case basis. This one was a no-brainer, which is good, but I am here to tell you that there are times when the old-school GCC extensions don't always make it through the standardization process in one piece. ;-)

Thanx, Paul

Quoted 46 lines
Quoted 46 lines
---
 CodeSamples/count/count_end.c |  2 +-
 count/count.tex               | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
CodeSamples/count/count_end.c +1 -1
index 5e7b9ee1025c..b6ed851c35a9 100644
@@ -23,7 +23,7 @@
 #include "../api.h"
 
 //\begin{snippet}[labelbase=ln:count:count_end:whole,commandchars=\\\@\$]
-unsigned long _Thread_local counter = 0;               //\lnlbl{var:b}
+unsigned long _Thread_local counter = 0;       //\lnlbl{var:b}
 unsigned long *counterp[NR_THREADS] = { NULL };
 unsigned long finalcount = 0;
 DEFINE_SPINLOCK(final_mutex);                  //\lnlbl{var:e}
count/count.tex +6 -6
index 775cf77e90a8..b2de4646b18f 100644
@@ -721,12 +721,12 @@ This is the topic of the next section.
 \subsection{Per-Thread-Variable-Based Implementation}
 \label{sec:count:Per-Thread-Variable-Based Implementation}
 
-The C language, since C11, features a \apig{_Thread_local} storage class that
-provides per-thread storage.
-\footnote{\GCC\ provides its own \apig{__thread} storage class, which was used
-in previous versions of this book.
-The two methods for specifying a thread-local variable are interchangeable
-when using \GCC\@.}
+The C language, since C11, features a \apic{_Thread_local} storage class that
+provides per-thread storage.\footnote{
+       \GCC\ provides its own \apig{__thread} storage class, which was used
+       in previous versions of this book.
+       The two methods for specifying a thread-local variable are
+       interchangeable when using \GCC\@.}
 This can be used as shown in
 \cref{lst:count:Per-Thread Statistical Counters} (\path{count_end.c})
 to implement

base-commit: ba01403b34de88d3060e119f899f5eb053c5f162 --
2.25.1