Browse Source

add close method to the filelock object.. and use that instead

of reaching in to do the close..

[git-p4: depot-paths = "//depot/": change = 1376]
main
John-Mark Gurney 15 years ago
parent
commit
e84ceaf7ce
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      filelock.py

+ 5
- 1
filelock.py View File

@@ -6,6 +6,10 @@ class FileLock(object):
self.f = open(fname, 'w+')
self.islocked = False

def close(self):
self.f.close()
self.islocked = None

def exclusivelock(self):
fcntl.flock(self.f.fileno(), fcntl.LOCK_EX)
self.islocked = True
@@ -25,5 +29,5 @@ class LockShelve(FileLock, shelve.DbfilenameShelf):
try:
shelve.DbfilenameShelf.__init__(self, fname, *args, **kwargs)
except:
self.f.close()
self.close()
raise

Loading…
Cancel
Save