This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fwd: local equivalent for pthread_once() in glibc?
- From: Florian Weimer <fweimer at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Date: Wed, 17 May 2017 11:57:00 +0200
- Subject: Re: Fwd: local equivalent for pthread_once() in glibc?
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=fweimer at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B644BC049D59
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B644BC049D59
- References: <9EBFE06E-AF1D-48E9-85AB-B74C048438B1@oracle.com> <F050C948-50BF-4305-84AC-9003F97D9F59@oracle.com> <be02ff5c-0313-29b2-e807-1a618559ec9c@redhat.com> <ff82b3b2-e282-9d88-775f-9fb46296787f@linaro.org>
On 04/26/2017 02:40 PM, Adhemerval Zanella wrote:
> Now that we are on the subject, shouldn't we use __libc_once on
> __malloc_initialized?
I think that would be misleading. The arena selection code assumes that
the main arena has been fully initialized, not just that ptmalloc_init
has run. ptmalloc_init only performs a partial initialization, the rest
is done through malloc_consolidate (which is again triggered by the
allocation which is part of pthread_create). If we fix ptmalloc_init to
allow concurrent invocation (although that never would happen), the lack
of full initialization would still be in issue (in the impossible case
that ptmalloc_init ran concurrenctly).
Thanks,
Florian