Skip to content

Commit 0b0ffe0

Browse files
authored
Merge pull request #169 from HFTrader/fix-spinlock-memory-order
Use memory_order_acquire for spinlock instead of acq_rel
2 parents e9a883c + 1dd2a87 commit 0b0ffe0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

libcuckoo/cuckoohash_map.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,14 +834,14 @@ private:
834834
}
835835

836836
void lock() noexcept {
837-
while (lock_.test_and_set(std::memory_order_acq_rel))
837+
while (lock_.test_and_set(std::memory_order_acquire))
838838
;
839839
}
840840

841841
void unlock() noexcept { lock_.clear(std::memory_order_release); }
842842

843843
bool try_lock() noexcept {
844-
return !lock_.test_and_set(std::memory_order_acq_rel);
844+
return !lock_.test_and_set(std::memory_order_acquire);
845845
}
846846

847847
counter_type &elem_counter() noexcept { return elem_counter_; }

0 commit comments

Comments
 (0)