Does std::thread::join guarantee writes visibility

后端 未结 2 1507
迷失自我
迷失自我 2021-01-18 08:26

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 ord

2条回答
  •  悲&欢浪女
    2021-01-18 08:43

    t1.join() will not return until thread execution is completed, so from your example g_i is guaranteed to be 1

提交回复
热议问题