clarifications on full memory barriers involved by pthread mutexes
问题 I have heard that when dealing with mutexes, the necessary memory barriers are handled by the pthread API itself. I would like to have more details on this matter. Are these claimings true, at least on the most common architectures around? Does the compiler recognize this implicit barrier, and avoids reordering of operations/read from local registers when generating the code? When is the memory barrier applied: after successfully acquiring a mutex AND after releasing it? 回答1: The POSIX