News for hackers. Stuff that matters.
Re:Setenv Is Not Thread Safe and C Doesn't Want to Fix It by johanbcn on Monday November 20, 2023 @05:21AM (#38345902)
Libraries shouldn't be reading environment variables, that responsibility should be only for the application.
Re:Setenv Is Not Thread Safe and C Doesn't Want to Fix It by kuon on Monday November 20, 2023 @06:08AM (#38346288)
It is common, out of my head SDL and pipewire do it.
Re:Setenv Is Not Thread Safe and C Doesn't Want to Fix It by lelanthran on Monday November 20, 2023 @07:50AM (#38347231)
They shouldn't, but if even the C standard library reads environment variables, then the bar is set pretty low for library designers.

Look up the mess around LOCALE sometime.

The best the programmer can do is perform all the setenv calls before spawning any threads or making any library calls.