• Maged Michael's avatar
    hazptr: Fix batch push obj · d0e76dbb
    Maged Michael authored
    Summary:
    Fix missing null check.
    It is possible for a thread to successfully CAS count from >= threshold to 0 and also pop an empty list.
    Example with 2 threads:
    - Batch contains Threshold - 1 objects
    - Thread 1 pushes an object, finds count == Threshold, CAS-es count to 0 successfully.
    - Thread 2 pushes Threshold more objects, finds count == Threshold, CAS-es count to 0 successfully.
    - Thread 1 pops all 2xThreshold objects (that's ok)
    - Thread 2 pops 0 objects (that's ok too but we need to do null check before dereferencing the head of the list).
    
    Reviewed By: davidtgoldblatt
    
    Differential Revision: D17680391
    
    fbshipit-source-id: a1d68997668077cc0b34cc66405628ed2f95702b
    d0e76dbb
HazptrObj.h 14.4 KB