1 from __future__
import absolute_import, division, print_function, unicode_literals
6 if sys.version <
'3.3':
9 FileExistsError = OSError
13 '''A primitive, file-based synchronization utility.''' 15 def __init__(self, lock_file_path, wait_seconds=0.1):
17 Creates a new :class:`FileBaton`. 20 lock_file_path: The path to the file used for locking. 21 wait_seconds: The seconds to periorically sleep (spin) when 30 Tries to atomically create a file under exclusive access. 33 True if the file could be created, else False. 38 except FileExistsError:
43 Periodically sleeps for a certain amount until the baton is released. 45 The amount of time slept depends on the ``wait_seconds`` parameter 46 passed to the constructor. 52 '''Releaes the baton and removes its file.'''
def __init__(self, lock_file_path, wait_seconds=0.1)