[PATCH] D52251: [builtins] Add __emutls_unregister_key function

enh via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 16:05:31 PDT 2018


yeah, we always used the low numbers internally.
On Wed, Sep 19, 2018 at 3:39 PM Ryan Prichard via Phabricator
<reviews at reviews.llvm.org> wrote:
>
> rprichard added inline comments.
>
>
> ================
> Comment at: lib/builtins/emutls.c:397
> +void __emutls_unregister_key(void) {
> +    pthread_key_delete(emutls_pthread_key);
> +}
> ----------------
> kongyi wrote:
> > chh wrote:
> > > Shouldn't this be called only after the pthread key was created?
> > > gcc's version has a flag emutls_key_created set only after emutls_init.
> > >
> > >
> > We don't need to check this, since emutls_key_delete is not expensive to call and we can safely ignore failure from it.
> This code assumes that a zeroed pthread_key_t is never valid. I suspect that's true for Bionic? I confirmed it on aosp-master and KitKat. For the NDK's purposes, it needs to be true for android-16 and up.
>
> It's apparently not generally true? http://www.tekkotsu.org/cvslog2web/2009/03/commit-1236808823.html
>
>
>
> Repository:
>   rCRT Compiler Runtime
>
> https://reviews.llvm.org/D52251
>
>
>


More information about the llvm-commits mailing list