Skip to content

Commit 3d96554

Browse files
authored
Merge pull request #35383 from mikeash/fix-concurrentarray-memory-order3
[Runtime] Make Concurrent.h ReaderCount loads seq_cst as well.
2 parents 6298351 + 1557dbc commit 3d96554

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
@@ -538,7 +538,7 @@ template <class ElemTy> struct ConcurrentReadableArray {
538538
new(&storage->data()[count]) ElemTy(elem);
539539
storage->Count.store(count + 1, std::memory_order_release);
540540

541-
if (ReaderCount.load(std::memory_order_acquire) == 0)
541+
if (ReaderCount.load(std::memory_order_seq_cst) == 0)
542542
deallocateFreeList();
543543
}
544544

@@ -853,7 +853,7 @@ struct ConcurrentReadableHashMap {
853853
/// Free all the arrays in the free lists if there are no active readers. If
854854
/// there are active readers, do nothing.
855855
void deallocateFreeListIfSafe() {
856-
if (ReaderCount.load(std::memory_order_acquire) == 0)
856+
if (ReaderCount.load(std::memory_order_seq_cst) == 0)
857857
FreeListNode::freeAll(&FreeList);
858858
}
859859

0 commit comments

Comments
 (0)