Closed requested to merge flow/emper:linux-version-construct-on-first-use into master
Use the "Construct on first use" idom for UTS Release (aka Linux version) initialization. The previous implementation was fragle and could lead to segfaults like
__s2=0x7fffffffe480 "5.16.10-arch1-1", __s1=<optimized out>) at /usr/include/c++/11.2.0/bits/char_traits.h:409 __n=<optimized out>, __s=0x7fffffffe480 "5.16.10-arch1-1", __d=<optimized out>) at /usr/include/c++/11.2.0/bits/basic_string.h:359 __n=<optimized out>, __s=0x7fffffffe480 "5.16.10-arch1-1", __d=<optimized out>) at /usr/include/c++/11.2.0/bits/basic_string.h:354 __str=..., this=0x7ffff7fbd2a0 <emper::lib::LinuxVersion::globalVersion[abi:cxx11]>) at /usr/include/c++/11.2.0/bits/basic_string.h:739 at ../emper/lib/LinuxVersion.cpp:46 at /usr/include/c++/11.2.0/ext/new_allocator.h:79
if globalVersion's constructor was not yet called. This is the so called "static initialization order fiasco" in C++.
While the mutex may not be strictly requires, as we do not call LinuxVersion's non-argument constructor nor getUtsRelease() concurrently, it can not hurt to have one.