• Roman Lebedev's avatar
    Cache: dt_cache_release_with_caller(): if no other readers, poison. · 8c50aa30
    Roman Lebedev authored
    We are using pthread's rwlock.
    At any given point in time, there can be either
    one(!) writer, or many readers.
    If we are unlocking writer, then there are no other
    clients (with read lock).
    If we are unlocking reader, there may be other readers.
    So if we are unlocking the last read lock, only then
    can we poison the memory. Else, we will get false
    FIXME: yes, this is *HIGHLY* unportable and
    is accessing implementation details. Once we migrate
    to CK, this should probably get better.
    Since this is only needed when compiling with ASAN,
    whoever wants to compile with ASAN with different
    pthread implementation shall simply change 1 to 0
    in #if
cache.c 11.4 KB