Separate lock file instad of log file locking
This commit is contained in:
parent
4ac933fa29
commit
484659fc3f
2 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue