[PATCH v2] Make bindresvport() function to multithread-safe

Peng Haitao penght@cn.fujitsu.com
Mon Sep 24 06:31:00 GMT 2012


On 09/20/2012 02:25 AM, Mike Frysinger wrote:
>> This patch is unacceptable for two reasons:
>>
>> (a) We define bindresvport() as non-thread-safe. Therefore the change
>> is not required.
>>
>> and
>>
>> (b) Adding locking to bindresvport() will only slow down the fast path
>> in the function.
>>
>> You have provided no rationale for the change.
>>
>> Until you provide some rationale, or prove that performance doesn't
>> matter in the case of this function, the change is unacceptable.
>>
>> Does that make sense?
> 
> rather than adding locks, what if the static's had __thread added, and getpid 
> was changed to gettid.
> -mike
> 

gettid()'s manpage said: gettid() is Linux-specific and should not be used
in programs that are intended to be portable.

It is rightly using gettid() in bindresvport()?

I will send v3 patch, please review.
Thanks.

-- 
Best Regards,
Peng



More information about the Libc-alpha mailing list