Add docstring to specific lock kinds

This commit is contained in:
Joshua Harlow 2015-06-19 16:49:15 -07:00
parent 83152bc303
commit 7e1babac4d
1 changed files with 2 additions and 4 deletions

View File

@ -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