Skip to content

Commit 39af41e

Browse files
committed
Fixing size counter
1 parent 441356f commit 39af41e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

include/wait_free_unordered_map.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ namespace wf
148148
arraynode_t m_head;
149149
std::size_t m_head_size;
150150
std::size_t m_arrayLength;
151-
std::size_t m_size;
151+
std::atomic<std::size_t> m_size;
152152
static constexpr std::size_t hash_size_in_bits = sizeof(hash_t) * std::numeric_limits<unsigned char>::digits;
153153
};
154154

@@ -210,6 +210,7 @@ namespace wf
210210
unordered_map<Key, Value, HashFunction>::unordered_map(std::size_t initialSize)
211211
: m_head(2UL << initialSize), m_head_size(2UL << initialSize), m_arrayLength(initialSize), m_size(0UL)
212212
{
213+
static_assert(std::atomic<std::size_t>::is_always_lock_free, "Atomic implementation is not lock free");
213214
static_assert(std::atomic<node_ptr>::is_always_lock_free, "Atomic implementation is not lock free");
214215

215216
if (!is_power_of_two(initialSize))

0 commit comments

Comments
 (0)