[webkit-reviews] review granted: [Bug 233851] [libpas] Set pthread_setspecific with marker in TLS destructor to detect TLS is destroyed : [Attachment 446080] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Dec 6 14:46:27 PST 2021


Mark Lam <mark.lam at apple.com> has granted Yusuke Suzuki <ysuzuki at apple.com>'s
request for review:
Bug 233851: [libpas] Set pthread_setspecific with marker in TLS destructor to
detect TLS is destroyed
https://bugs.webkit.org/show_bug.cgi?id=233851

Attachment 446080: Patch

https://bugs.webkit.org/attachment.cgi?id=446080&action=review




--- Comment #10 from Mark Lam <mark.lam at apple.com> ---
Comment on attachment 446080
  --> https://bugs.webkit.org/attachment.cgi?id=446080
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=446080&action=review

Nice.  r=me

> Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c:101
> +    /* If pthread_self_is_exiting_np does not exist, we set
PAS_THREAD_LOCAL_CACHE_DESTROYED to the TLS so that

/to the TLS/in the TLS/

> Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c:103
> +	  subsequent calls of pas_thread_local_cache_try_get() can detect
whether TLS is destroyed. Since it is not
> +	  NULL, this destructor will be called once again later. We repeat
invoking this destructor PTHREAD_DESTRUCTOR_ITERATIONS times. */

I suggest rephrasing the last 2 sentences (starting with "Since it is not ...")
as follows:
Since PAS_THREAD_LOCAL_CACHE_DESTROYED is a non-null value, pthread will call
this destructor again (up to PTHREAD_DESTRUCTOR_ITERATIONS times). Each time it
does, it will clear the TLS entry. Hence, we need to re-set
PAS_THREAD_LOCAL_CACHE_DESTROYED in the TLS each time to continue to indicate
that destroy() has already been called once.


More information about the webkit-reviews mailing list