[PATCH v2] Make bindresvport() function to multithread-safe
Carlos O'Donell
carlos@systemhalted.org
Wed Sep 19 06:56:00 GMT 2012
On Tue, Sep 18, 2012 at 9:45 PM, Peng Haitao <penght@cn.fujitsu.com> wrote:
> bindresvport() uses two static variables port and startport which are not
> protected. It is not safe when in multithread circumstance.
>
> bindresvport() select a port number from the range 512 to 1023, when in
> multithread circumstance, the port may be 1024. So the static variables will be
> protected.
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?
Cheers,
Carlos.
More information about the Libc-alpha
mailing list