Show More
@@ -71,7 +71,7 b' class lock(object):' | |||||
71 | except (OSError, IOError), why: |
|
71 | except (OSError, IOError), why: | |
72 | if why.errno == errno.EEXIST: |
|
72 | if why.errno == errno.EEXIST: | |
73 | locker = self.testlock() |
|
73 | locker = self.testlock() | |
74 | if locker: |
|
74 | if locker is not None: | |
75 | raise LockHeld(errno.EAGAIN, self.f, self.desc, |
|
75 | raise LockHeld(errno.EAGAIN, self.f, self.desc, | |
76 | locker) |
|
76 | locker) | |
77 | else: |
|
77 | else: | |
@@ -79,11 +79,16 b' class lock(object):' | |||||
79 | why.filename, self.desc) |
|
79 | why.filename, self.desc) | |
80 |
|
80 | |||
81 | def testlock(self): |
|
81 | def testlock(self): | |
82 |
|
|
82 | """return id of locker if lock is valid, else None. | |
83 | # if old-style lock, we cannot tell what machine locker is on. |
|
83 | ||
84 | # with new-style lock, if locker is on this machine, we can |
|
84 | If old-style lock, we cannot tell what machine locker is on. | |
85 |
|
|
85 | with new-style lock, if locker is on this machine, we can | |
86 | # not alive, we can safely break lock. |
|
86 | see if locker is alive. If locker is on this machine but | |
|
87 | not alive, we can safely break lock. | |||
|
88 | ||||
|
89 | The lock file is only deleted when None is returned. | |||
|
90 | ||||
|
91 | """ | |||
87 | locker = util.readlock(self.f) |
|
92 | locker = util.readlock(self.f) | |
88 | try: |
|
93 | try: | |
89 | host, pid = locker.split(":", 1) |
|
94 | host, pid = locker.split(":", 1) |
General Comments 0
You need to be logged in to leave comments.
Login now