On Wed, Jun 25, 2025 at 10:25:23AM -0400, Mathieu Desnoyers wrote:
> On 2025-06-24 23:10, Boqun Feng wrote:
> [...]
> > +
> > +static inline void shazptr_clear(struct shazptr_guard guard)
> > +{
> > +   /* Only clear the slot when the outermost guard is released */
> > +   if (likely(!guard.use_wildcard))
> > +           smp_store_release(guard.slot, NULL); /* Pair with ACQUIRE at 
> > synchronize_shazptr() */
> 
> How is the wildcard ever cleared ?
> 

The outermost shazptr_guard will have .use_wildcard being false, so it
will clear the wildcard. E.g.

        g1 = shazptr_acqure(a); // g1->use_wildcard is false
                                // this cpu's hazptr slot is 'a'.
        g2 = shazptr_acqure(b); // g2->use_wildcard is true
                                // this cpu's hazptr slot becomes
                                // WILDCARD.

        shazptr_clear(g2);      // do nothing
        shazptr_clear(g1);      // clear this cpu's hazptr slot to NULL.

Regards,
Boqun

> Thanks,
> 
> Mathieu
> 
> 
> -- 
> Mathieu Desnoyers
> EfficiOS Inc.
> https://www.efficios.com

Reply via email to