This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] Make fprintf() function to multithread-safe
On 07/10/2012 05:18 PM, Roland McGrath wrote:
> Please file a bugzilla report for this issue.
>
Please refer to URL:
http://sourceware.org/bugzilla/show_bug.cgi?id=14267
> I am not at all sanguine about taking any global locks in vfprintf,
> even a reader lock. It is a code path that is extremely common and
> often performance-critical. Conversely, register_printf_specifier
> et al are called very rarely and their performance never matters much.
>
> I think it's worth investigating an alternative approach where
> changes work by allocating a new table and replacing the old one
> with atomic operations. There is complexity there about tracking
> when it's safe to free the old table, so it's not a trivial change.
>
Thanks.
__register_printf_specifier() can register or remove a conversion with
__printf_function_table. If allocate a new table and replace the old
one with atomic operations, the __printf_function_table may be out-of-date.
For example, first examine __printf_function_table is not NULL.
If __printf_function_table is not NULL, allocate a new table and replace
the old one with atomic operations. but when use __printf_function_table,
__printf_function_table may be is modified. but a new table
is not modified:(
--
Best Regards,
Peng