This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make fprintf() function to multithread-safe


On 06/20/2012 03:08 PM, Andreas Schwab wrote:
> Peng Haitao <penght@cn.fujitsu.com> writes:
> 
>> diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
>> index d569034..18bc81e 100644
>> --- a/stdio-common/vfprintf.c
>> +++ b/stdio-common/vfprintf.c
>> @@ -195,6 +195,8 @@ static CHAR_T *group_number (CHAR_T *, CHAR_T *, const char *, const char *)
>>       __THROW internal_function;
>>  #endif
>>  
>> +__libc_rwlock_define (extern, lock_function)
>> +__libc_rwlock_define (extern, lock_type)
> 
> A single lock should be enough.
> 

stdio-common/reg-type.c   modifies __printf_va_arg_tableï
stdio-common/reg-printf.c modifies __printf_function_tableï
stdio-common/vfprintf.c uses __printf_va_arg_table and __printf_function_table simultaneously.

I think use two locks will be better. because __printf_va_arg_table and __printf_function_table
can be modified simultaneously when use two locks.

Thank you for you response.

-- 
Best Regards,
Peng


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]