• Tamar Christina's avatar
    Make System.IO.openTempFile thread-safe on Windows · 2fc621df
    Tamar Christina authored
    This calls out to the Win32 API `GetTempFileName` to generate
    a temporary file. Using `uUnique = 0` guarantees that the file
    we get back is unique and the file is "reserved" by creating it.
    
    Test Plan:
    ./validate
    
    I can't think of any sensible tests that shouldn't run for a while
    to verify. So the example in #10731 was ran for a while and no
    collisions in new code
    
    Reviewers: hvr, bgamari, erikd
    
    Reviewed By: bgamari
    
    Subscribers: RyanGlScott, rwbarton, thomie, carter
    
    GHC Trac Issues: #10731
    
    Differential Revision: https://phabricator.haskell.org/D4278
    
    (cherry picked from commit 46287af0)
    2fc621df
Win32Utils.c 6.83 KB