This means that in the absence of synchronization, memory operations can appear to happen in different orders from the perspective of different threads.
这意味着在缺乏同步的情况下,从不同的线程角度来看,内存的操作是以不同的次序发生的。
Otherwise, if two threads tried to execute the increment simultaneously, an unlucky interleaving of operations would result in the counter being incremented only once, instead of twice.
否则,如果两个线程试图同时执行增加,操作的不幸交叉将导致计数器只被实现了一次,而不是被实现两次。
应用推荐