Open storypku opened 5 years ago
@storypku Yes, you are right. We provide two Get
funcions, one for faster access and the other for thread safe. You can choose a more appropriate interface based on your own usage scenario.
I'm sorry to confuse you, we'll add more detailed comments later.
@fengqikai1414 In fact, neither of the two Get
functions is thread-safe: *v = *target->value_ptr.load(std::memory_order_acquire);
is not an atomic operation.
@storypku Thank you for your reminder. We'll see how to fix it.
@storypku After careful analysis, the scenario used in cyber RT does not trigger this problem, we will completely solve this problem after upgrading to C++17.
@fengqikai1414 Any ideas on how to resolve this as we are targeting C++17 now?
Describe the bug Impl of AtomicHashMap isn't thread-safe.
To Reproduce Steps to reproduce the behavior: Given the following example:
Output: Got: (null)
Additional context Although we can hardly observe above senerio using AtomicHashMap::Get(K, V*) rather than Get(K, V**), the bug is intrinsic to AtomicHashMap implementation.