Separate lock file instad of log file locking

This commit is contained in:
shortcutme 2016-11-07 22:34:12 +01:00
parent 4ac933fa29
commit 484659fc3f
2 changed files with 7 additions and 2 deletions

View file

@ -39,6 +39,10 @@ def openLocked(path, mode="w"):
import fcntl
f = open(path, mode)
fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
elif os.name == "nt":
import msvcrt
f = open(path, mode)
msvcrt.locking(f.fileno(), msvcrt.LK_NBLCK, -1)
else:
f = open(path, mode)
return f