Add docstring to specific lock kinds
This commit is contained in:
parent
83152bc303
commit
7e1babac4d
|
@ -207,6 +207,7 @@ class _InterProcessLock(object):
|
|||
|
||||
|
||||
class _WindowsLock(_InterProcessLock):
|
||||
"""Interprocess lock implementation that works on windows systems."""
|
||||
|
||||
def trylock(self):
|
||||
msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_NBLCK, 1)
|
||||
|
@ -216,6 +217,7 @@ class _WindowsLock(_InterProcessLock):
|
|||
|
||||
|
||||
class _FcntlLock(_InterProcessLock):
|
||||
"""Interprocess lock implementation that works on posix systems."""
|
||||
|
||||
def trylock(self):
|
||||
fcntl.lockf(self.lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
|
@ -226,13 +228,9 @@ class _FcntlLock(_InterProcessLock):
|
|||
|
||||
if os.name == 'nt':
|
||||
import msvcrt
|
||||
|
||||
#: Interprocess lock implementation that works on your system.
|
||||
InterProcessLock = _WindowsLock
|
||||
else:
|
||||
import fcntl
|
||||
|
||||
#: Interprocess lock implementation that works on your system.
|
||||
InterProcessLock = _FcntlLock
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue