[PATCH] D33521: [sanitizer] Pair atomic acquire with release in BlockingMutex::Unlock
Aleksey Shlyapnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 14:43:33 PDT 2017
alekseyshl created this revision.
Herald added a subscriber: kubamracek.
Dmitry, seeking your expertise. I believe, the proper way to implement
Lock/Unlock here would be to use acquire/release semantics. Am I missing
something?
https://reviews.llvm.org/D33521
Files:
lib/sanitizer_common/sanitizer_linux.cc
Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -549,7 +549,7 @@
void BlockingMutex::Unlock() {
atomic_uint32_t *m = reinterpret_cast<atomic_uint32_t *>(&opaque_storage_);
- u32 v = atomic_exchange(m, MtxUnlocked, memory_order_relaxed);
+ u32 v = atomic_exchange(m, MtxUnlocked, memory_order_release);
CHECK_NE(v, MtxUnlocked);
if (v == MtxSleeping) {
#if SANITIZER_FREEBSD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33521.100166.patch
Type: text/x-patch
Size: 547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170524/93d63a40/attachment.bin>
More information about the llvm-commits
mailing list