Closed SeongJinAhn closed 5 years ago
swap
performs read and write at the same time. The acquire
annotation in swap()
also means it disallows hoisting of later instructions.
(Closing, as it seems @SeongJinAhn acknowledged my answer. Feel free to reopen it!)
In p18 it is said that X.load(acquire) disallows hoisting of later instruction. But in p19 lock.swap(true,acquire) is written tosolve problem of spinlock rather than lock.load(true,acquire). Is it right? If then could you tell me the reason?