defer/hazptr: Fix line number reference in Section 9.3 Hazard Pointers
PATCH 1/1 defer/hazptr: Fix line number reference in Section 9.3 Hazard Pointers
The text incorrectly stated that 'line 8 finds' the pointer condition, but in Listing 9.4, line 7 contains the if statement that performs the check, while line 8 contains the return statement.
This commit:
1. Adds a label (htr:check) to the if statement on line 7
2. Updates the text to reference the if check (htr:check) instead of the return statement (htr:race1) for the condition check
3. Clarifies that the if check finds the condition and the return statement returns the value
This makes the description more accurate and reflects the actual code execution flow.
--- CodeSamples/defer/hazptr.h | 2 +- defer/hazptr.tex | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
CodeSamples/defer/hazptr.h +1 -1
@@ -74,7 +74,7 @@ static inline void *_h_t_r_impl(void **p, //\lnlbl{htr:b}void *tmp; tmp =READ_ONCE (*p);//\lnlbl{htr:ro1} -if (!tmp || tmp == (void *)HAZPTR_POISON ) +if (!tmp || tmp == (void *)HAZPTR_POISON )//\lnlbl{htr:check} return tmp;//\lnlbl{htr:race1} WRITE_ONCE (hp->p, tmp);//\lnlbl{htr:store} smp_mb ();//\lnlbl{htr:mb}
defer/hazptr.tex +2 -2
@@ -69,8 +69,8 @@ Finally, if it fails due to racing with an update, it returns a special }\QuickQuizEnd \Clnref{htr:ro1} reads the pointer to the object to be protected. -If \clnref{htr:race1} finds that this pointer was either \co{NULL} or -the special \co{HAZPTR_POISON} deleted-object token, it returns +If \clnref{htr:check} finds that this pointer was either \co{NULL} or +the special \co{HAZPTR_POISON} deleted-object token, then \clnref{htr:race1} returns the pointer's value to inform the caller of the failure. Otherwise, \clnref{htr:store} stores the pointer into the specified hazard pointer, and \clnref{htr:mb} forces full ordering of that
Signature · 1 line
2.25.1
Quoted 11 lines · Kunwu Chan
The text incorrectly stated that 'line 8 finds' the pointer condition, but in Listing 9.4, line 7 contains the if statement that performs the check, while line 8 contains the return statement.
This commit:
1. Adds a label (htr:check) to the if statement on line 7
2. Updates the text to reference the if check (htr:check) instead of the return statement (htr:race1) for the condition check
3. Clarifies that the if check finds the condition and the return statement returns the value
Quoted 4 lines
This makes the description more accurate and reflects the actual code execution flow.
Signed-off-by Kunwu Chan <[email protected]>
Good catch, applied, thank you!
Thanx, Paul
Quoted 37 lines
--- CodeSamples/defer/hazptr.h | 2 +- defer/hazptr.tex | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)CodeSamples/defer/hazptr.h +1
-1@@ -74,7 +74,7 @@ static inline void *_h_t_r_impl(void **p, //\lnlbl{htr:b}void *tmp; tmp =READ_ONCE (*p);//\lnlbl{htr:ro1} -if (!tmp || tmp == (void *)HAZPTR_POISON ) +if (!tmp || tmp == (void *)HAZPTR_POISON )//\lnlbl{htr:check} return tmp;//\lnlbl{htr:race1} WRITE_ONCE (hp->p, tmp);//\lnlbl{htr:store} smp_mb ();//\lnlbl{htr:mb} defer/hazptr.tex +2
-2@@ -69,8 +69,8 @@ Finally, if it fails due to racing with an update, it returns a special }\QuickQuizEnd \Clnref{htr:ro1} reads the pointer to the object to be protected. -If \clnref{htr:race1} finds that this pointer was either \co{NULL} or -the special \co{HAZPTR_POISON} deleted-object token, it returns +If \clnref{htr:check} finds that this pointer was either \co{NULL} or +the special \co{HAZPTR_POISON} deleted-object token, then \clnref{htr:race1} returns the pointer's value to inform the caller of the failure. Otherwise, \clnref{htr:store} stores the pointer into the specified hazard pointer, and \clnref{htr:mb} forces full ordering of thatSignature · 1 line
2.25.1