• Mike Kolupaev's avatar
    folly::AtomicHashMap: fixed race between erase() and find() · b4746252
    Mike Kolupaev authored
    Summary: advancePastEmpty() was called for all created iterators. It only makes sense for begin(). For find() it's harmful: find() shouldn't return an iterator to the next element if the key was removed. I suspect that the same race condition was possible for insert(), but I haven't tried to reproduce it.
    
    Test Plan: Added a test for it. It fails without these changes.
    
    Reviewed By: delong.j@fb.com
    
    Subscribers: folly-diffs@, lovro
    
    FB internal diff: D1751280
    
    Tasks: 5841499
    
    Signature: t1:1751280:1419107193:71311ff68d92d0a4dcf1941dacdfdc23c25255cc
    b4746252
AtomicHashMap.h 14.2 KB