jus*_*bie 2 c++ multithreading language-lawyer fmt c++23
std::print() 将在 C++23 中添加。
我想知道是否std::print()是线程安全的,因为没有数据竞争
它是否存在文本交错问题,例如,如果我在线程 1 中存在:
std::print("The quick brown fox ")
std::print("jump over the lazy dog \n")
Run Code Online (Sandbox Code Playgroud)
和线程 2:
std::print("She sells ")
std::print("seashells by the seashore \n")
Run Code Online (Sandbox Code Playgroud)
它会以疯狂的顺序打印吗,就像这样:
She sells The quick brown fox seashells by the seashore \n
jump over the lazy dog \n
Run Code Online (Sandbox Code Playgroud)
我想这两个问题的答案都是肯定的,与 的行为相匹配std::cout,但是任何人都可以将我与标准所说的联系起来吗?