Does std::thread::join guarantee writes visibility
问题 Std::thread::join is said to 'synchronize-with' the joined thread, however synchronization doesnt tell anything about visibility of side effects, it merely governs the order of the visiblity, ie. in following example: int g_i = 0; int main() { auto fn = [&] {g_i = 1;}; std::thread t1(fn); t1.join(); return g_i; } Do we have any guarantee in the c++ standard that this program will always return 1? 回答1: [thread.thread.member]: void join(); Effects : Blocks until the thread represented by *this