|
|
|
|
|
by gpderetta
2362 days ago
|
|
> you could possibly do away atomics, since (I believe) int updates are atomic by default. The release can be a compiler only barrier followed by a simple store, but you do need an atomic RMW in the acquire path. It is technically possible to implement a lock with just loads and stores (see Peterson lock[1]) even in the acquire path but it does require a #StoreLoad memory barrier even on Intel, which is as expensive as an atomic RMW so it is not worth it. Edit:fixed barrier name typo. [1] https://en.m.wikipedia.org/wiki/Peterson%27s_algorithm |
|
What is that? x86 is TSO...
Do you have an example of the full acquire and release sections in x86 assembly?