Skip to content

Commit 6467827

Browse files
committed
[Runtime] Fix memory ordering on two loads in ConcurrentReadableHashMap.
1 parent 9bc2819 commit 6467827

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/swift/Runtime/Concurrent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ template <class ElemTy> struct ConcurrentReadableHashMap {
684684
/// Free all the arrays in the free lists if there are no active readers. If
685685
/// there are active readers, do nothing.
686686
void deallocateFreeListIfSafe() {
687-
if (ReaderCount.load(std::memory_order_relaxed) == 0)
687+
if (ReaderCount.load(std::memory_order_acquire) == 0)
688688
deallocateFreeList();
689689
}
690690

@@ -857,7 +857,7 @@ template <class ElemTy> struct ConcurrentReadableHashMap {
857857
ElemTy *elements2;
858858
do {
859859
elements = Elements.load(std::memory_order_acquire);
860-
indices = Indices.load(SWIFT_MEMORY_ORDER_CONSUME);
860+
indices = Indices.load(std::memory_order_acquire);
861861
elementCount = ElementCount.load(std::memory_order_acquire);
862862
elements2 = Elements.load(std::memory_order_acquire);
863863
} while (elements != elements2);

0 commit comments

Comments
 (0)