Changeset 793 for trunk/packages/sipb-xen-base/files/usr/share/python-support/sipb-xen-base/invirt/common.py
- Timestamp:
- Jul 30, 2008, 9:50:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-base/files/usr/share/python-support/sipb-xen-base/invirt/common.py
r790 r793 40 40 return wrapper 41 41 42 def with_lock_file(path ):42 def with_lock_file(path, exclusive = True): 43 43 """ 44 44 Context manager for lock files. Example: … … 54 54 @with_closing(file(path, 'w')) 55 55 def g(f): 56 flock(f, LOCK_EX) 56 if exclusive: locktype = LOCK_EX 57 else: locktype = LOCK_SH 58 flock(f, locktype) 57 59 try: return func() 58 60 finally: flock(f, LOCK_UN)
Note: See TracChangeset
for help on using the changeset viewer.