Skip to contentSkip to conversation

toolsoftrade: Consistently add parentheses to function names

PATCH Applied SeongJae Park 2 participants 6 messages Oct 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 toolsoftrade: Consistently add parentheses to function names

Parentheses are appended to all function names including 'mythread()', but one case is not. This commit adds parentheses there.

---
 toolsoftrade/toolsoftrade.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolsoftrade/toolsoftrade.tex +1 -1
index c9f5b399..b2694da2 100644
@@ -344,7 +344,7 @@ ID of the thread to be created, the second \co{NULL} argument is a pointer
 to an optional \co{pthread_attr_t}, the third argument is the function
 (in this case, \co{mythread()})
 that is to be invoked by the new thread, and the last \co{NULL} argument
-is the argument that will be passed to \co{mythread}.
+is the argument that will be passed to \co{mythread()}.
 \end{fcvref}
 
 \begin{listing}
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/5 toolsoftrade: Add arguments in 'WRITE_ONCE()' example

A sentence explaining common things between 'READ_ONCE()' and '__atomic_load_n()' provides arguments, but the explanation for 'WRITE_ONCE()' doesn't. This commit makes it also consistently provides the arguments.

---
 toolsoftrade/toolsoftrade.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolsoftrade/toolsoftrade.tex +1 -1
index b2694da2..bc332aba 100644
@@ -544,7 +544,7 @@ primitives.
 	\cref{chp:Advanced Synchronization: Memory Ordering}.
 	In the meantime, \co{READ_ONCE(x)} has much in common with
 	the \GCC\  intrinsic \co{__atomic_load_n(&x, __ATOMIC_RELAXED)}
-	and \co{WRITE_ONCE()} has much in common with the \GCC\ 
+	and \co{WRITE_ONCE(x, v)} has much in common with the \GCC\
 	intrinsic \co{__atomic_store_n(&x, v, __ATOMIC_RELAXED)}.
 }\QuickQuizEndE
 }
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/5 toolsoftrade: Consistently wrap 'volatile' with '\co{}'

In reply to SeongJae Park

A sentence is wrapping 'volatile' with '\co{}' for most cases but one case. This commit makes it consistently wrap the keyword with the macro.

---
 toolsoftrade/toolsoftrade.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolsoftrade/toolsoftrade.tex +1 -1
index bc332aba..f0fb360c 100644
@@ -803,7 +803,7 @@ rights to assume that the value of \co{goflag} would never change.
 	most of the accesses are protected by a lock (and thus \emph{not}
 	subject to change), but where a few of the accesses are made outside
 	of the lock.
-	Using a volatile declaration in this case would make it harder
+	Using a \co{volatile} declaration in this case would make it harder
 	for the reader to note the special accesses outside of the lock,
 	and would also make it harder for the compiler to generate good
 	code under the lock.
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/5 toolsoftrade: Fix a typo

In reply to SeongJae Park
---
 toolsoftrade/toolsoftrade.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolsoftrade/toolsoftrade.tex +1 -1
index f0fb360c..7cbe2f0b 100644
@@ -851,7 +851,7 @@ rights to assume that the value of \co{goflag} would never change.
 	This leads to the question of how one thread can gain access to
 	another thread's \apig{__thread} variable, and the answer is that
 	the second thread must store a pointer to its \apig{__thread}
-	pointer somewhere that the first thread has access to.
+	variable somewhere that the first thread has access to.
 	One common approach is to maintain a linked list with one
 	element per thread, and to store the address of each thread's
 	\apig{__thread} variable in the corresponding element.
Signature · 1 line
2.17.1
#4 lore raw

PATCH 5/5 toolsoftrade: Use '\co{}' instead of '{\tt}'

In reply to SeongJae Park

There is a sentence using '{\tt}' instead of '\co{}'. This commit updates those.

---
 toolsoftrade/toolsoftrade.tex | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
toolsoftrade/toolsoftrade.tex +5 -5
index 7cbe2f0b..8badbcaf 100644
@@ -1448,10 +1448,10 @@ spin_unlock(&mutex);
 \end{VerbatimU}
 
 \QuickQuiz{
-	What problems could occur if the variable {\tt counter} were
-	incremented without the protection of {\tt mutex}?
+	What problems could occur if the variable \co{counter} were
+	incremented without the protection of \co{mutex}?
 }\QuickQuizAnswer{
-	On CPUs with load-store architectures, incrementing {\tt counter}
+	On CPUs with load-store architectures, incrementing \co{counter}
 	might compile into something like the following:
 
 \begin{VerbatimU}
@@ -1461,9 +1461,9 @@ STORE r0,counter
 \end{VerbatimU}
 
 	On such machines, two threads might simultaneously load the
-	value of {\tt counter}, each increment it, and each store the
+	value of \co{counter}, each increment it, and each store the
 	result.
-	The new value of {\tt counter} will then only be one greater
+	The new value of \co{counter} will then only be one greater
 	than before, despite two threads each incrementing it.
 }\QuickQuizEnd
 
Signature · 1 line
2.17.1
#5 lore raw
In reply to SeongJae Park
Quoted 4 lines · SeongJae Park

Parentheses are appended to all function names including 'mythread()', but one case is not. This commit adds parentheses there.

Queued and pushed the series, thank you!

Thanx, Paul

Quoted 20 lines
---
 toolsoftrade/toolsoftrade.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolsoftrade/toolsoftrade.tex +1 -1
index c9f5b399..b2694da2 100644
@@ -344,7 +344,7 @@ ID of the thread to be created, the second \co{NULL} argument is a pointer
 to an optional \co{pthread_attr_t}, the third argument is the function
 (in this case, \co{mythread()})
 that is to be invoked by the new thread, and the last \co{NULL} argument
-is the argument that will be passed to \co{mythread}.
+is the argument that will be passed to \co{mythread()}.
 \end{fcvref}
 
 \begin{listing}
Signature · 1 line
2.17.1