C++20 introduced synchronized streams.
Multiple synchronized streams can be used to write to a single destination stream without introducing data races or interleaving as long as all accesses to that stream are through a synchronized stream.
Compiler Explorer link: https://compiler-explorer.com/z/8qMs9M9Yv