1 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
9 def lock(n, non_block = 0):
10 f = open(path.lock_dir + '/' + n, "a")
11 # blah, otherwise it gets garbage collected and doesn't work
15 fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
20 fcntl.flock(f, fcntl.LOCK_EX)