• Zejun Wu's avatar
    Fix deadlock bug when mkFastStringWith is duplicated · f088c2d4
    Zejun Wu authored
    In D5211, we use `withMVar` to guard writes to the same segment, this
    is unsafe to be duplicated. It can lead to deadlock if it is only run
    partially and `putMVar` is not called after `takeMVar`.
    Test Plan:
    We used to see deadlock when building stackage without this fix, and it
    no longer happens.
    Reviewers: simonmar, bgamari
    Reviewed By: simonmar
    Subscribers: rwbarton, carter
    Differential Revision: https://phabricator.haskell.org/D5349
FastString.hs 23.2 KB