TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Don't setenv in multi-threaded code on glibc

19 点作者 goranmoomin10 个月前

3 条评论

rwmj10 个月前
What&#x27;s interesting is that setenv itself is protected by a lock so multiple parallel calls to setenv ought to work (I didn&#x27;t actually check). getenv doesn&#x27;t use a lock.<p><a href="https:&#x2F;&#x2F;sourceware.org&#x2F;git&#x2F;?p=glibc.git;a=blob;f=stdlib&#x2F;setenv.c;h=e2164371ade896e9b3342754724e5ca381beb64e;hb=HEAD#l55" rel="nofollow">https:&#x2F;&#x2F;sourceware.org&#x2F;git&#x2F;?p=glibc.git;a=blob;f=stdlib&#x2F;sete...</a>
jwilk10 个月前
(2017)<p>Discussed back then:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13528407">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13528407</a> (104 comments)
NewJazz10 个月前
Is there <i>ever</i> a reason to call setenv? execve and posix_spawn both let you pass an environment.<p>Edit: hmm I guess variables like LD_PRELOAD and PATH that get used by the standard lib you might want to set. Or if any other libraries modify their runtime behavior based on env vars.
评论 #41080503 未加载