• Thomas Schilling's avatar
    Make access to NameCache atomic. Sometimes needs a lock. · 9f68c348
    Thomas Schilling authored
    'readBinIface' updates the name cache in a way that is hard to use
    with atomicModifyIORef, so this patch introduces a lock for this case.
    All other updates use atomicModifyIORef.
    
    Having a single lock is quite pessimistic, so it remains to be seen
    whether this will become a problem.  In principle we only need to make
    sure that we do not load the same file concurrently (or that it's
    idempotent).  In practice we also need to ensure that concurrent reads
    do not cancel each other out (since the new NameCache may be based on
    an outdated version).
    9f68c348
HscTypes.lhs 81.5 KB