On Mon, Jan 19, 2026 at 11:11:30PM +0800, Kunwu Chan wrote:
> 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.
> 
> Signed-off-by: Kunwu Chan <[email protected]>

Good catch, applied, thank you!

                                                        Thanx, Paul

> ---
>  CodeSamples/defer/hazptr.h | 2 +-
>  defer/hazptr.tex           | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/CodeSamples/defer/hazptr.h b/CodeSamples/defer/hazptr.h
> index bdeb5c15..2d5a098f 100644
> --- a/CodeSamples/defer/hazptr.h
> +++ b/CodeSamples/defer/hazptr.h
> @@ -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}
> diff --git a/defer/hazptr.tex b/defer/hazptr.tex
> index 22fca499..50ff0996 100644
> --- a/defer/hazptr.tex
> +++ b/defer/hazptr.tex
> @@ -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
> -- 
> 2.25.1
> 
> 

Reply via email to