This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Making getenv more multi-threading--robust?
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: Stephan Bergmann <sbergman at redhat dot com>, libc-alpha at sourceware dot org
- Date: Thu, 13 Sep 2012 12:53:43 -0700 (PDT)
- Subject: Re: Making getenv more multi-threading--robust?
- References: <5051BBEF.4080401@redhat.com><1347565438.3374.426.camel@triegel.csb>
> If different threads frequently call getenv, this could decrease
> performance due to cache misses and/or contention on the lock.
Indeed. As getenv is a dumb linear search, anything calling it in a
performance-critical situation is stupid to begin with. But we should
avoid degrading any such existing cases, however stupid they are.
> *If* this is problem that we face in practice, then we can likely
> synchronize differently in getenv (i.e., return consistent information
> without any special ordering guarantees wrt setenv calls). In that
> case, I can help with that.
Such help is most welcome.
Thanks,
Roland