Skip to content

Windows: make openTempFile fully atomic.

Tamar Christina requested to merge Phyx/ghc:gh-10731-make-tempfile-atomic into master

Previous fix for #10731 (closed) made the creation of the temp file atomic and threadsafe but the rename was not made atomic.

This is because by default MoveFileW schedules a rename, but doesn't guarantee that the operation is completed immediately.

We now pass write-through as a flag, forcing it to wait till the change has been written. If the rename fails we retry the whole process up to a set maximum.

Fixes #10731 (closed)

Merge request reports