Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's true that the compiler can't move reads/write out from between a load-acquire and store-release pair, but in my understanding it can certainly move reads/writes into the pair. Or can someone point me to the exact section of the standard where this is prohibited?

I think my stack overflow link above gives a more satisfying explanation on why the example can't deadlock.



I now think it's actually this part of the standard that prevents it: http://eel.is/c++draft/intro.multithread#intro.progress-7

Basically a compiler can not optimize a non-deadlocking program into a potentially deadlocking one.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: