rdpeng/filehash — pull request #6 by jonathan-g (2014-07-13 20:59:18+00:00)
Title: Suggested fix for race conditiion with lock files

Windows 7 64-bit seems to have a race condition where the lockfile is sometimes present when lock_file is called, but if I wait and call lock_file a few hundred milliseconds later, the lockfile has vanished. (See issue https://github.com/rdpeng/filehash/issues/5).

This patch attempts to fix the problem, and it seems to work reliably on my system. I don't know with certainty whether this might have unintended consequences with other parts of filehash, but I can't see how it would, other than delaying for up to two seconds a failure (stop) from occurring in createLockFile().