Skip to content
  • Zejun Wu's avatar
    Fix deadlock bug when mkFastStringWith is duplicated · f088c2d4
    Zejun Wu authored and Ben Gamari's avatar Ben Gamari committed
    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:
      ./validate
    
    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
    f088c2d4