Show More
@@ -113,18 +113,7 b' class lock(object):' | |||||
113 | return None |
|
113 | return None | |
114 | raise |
|
114 | raise | |
115 |
|
115 | |||
116 | def testlock(self): |
|
116 | def _testlock(self, locker): | |
117 | """return id of locker if lock is valid, else None. |
|
|||
118 |
|
||||
119 | If old-style lock, we cannot tell what machine locker is on. |
|
|||
120 | with new-style lock, if locker is on this machine, we can |
|
|||
121 | see if locker is alive. If locker is on this machine but |
|
|||
122 | not alive, we can safely break lock. |
|
|||
123 |
|
||||
124 | The lock file is only deleted when None is returned. |
|
|||
125 |
|
||||
126 | """ |
|
|||
127 | locker = self._readlock() |
|
|||
128 | if locker is None: |
|
117 | if locker is None: | |
129 | return None |
|
118 | return None | |
130 | try: |
|
119 | try: | |
@@ -148,6 +137,20 b' class lock(object):' | |||||
148 | except error.LockError: |
|
137 | except error.LockError: | |
149 | return locker |
|
138 | return locker | |
150 |
|
139 | |||
|
140 | def testlock(self): | |||
|
141 | """return id of locker if lock is valid, else None. | |||
|
142 | ||||
|
143 | If old-style lock, we cannot tell what machine locker is on. | |||
|
144 | with new-style lock, if locker is on this machine, we can | |||
|
145 | see if locker is alive. If locker is on this machine but | |||
|
146 | not alive, we can safely break lock. | |||
|
147 | ||||
|
148 | The lock file is only deleted when None is returned. | |||
|
149 | ||||
|
150 | """ | |||
|
151 | locker = self._readlock() | |||
|
152 | return self._testlock(locker) | |||
|
153 | ||||
151 | def release(self): |
|
154 | def release(self): | |
152 | """release the lock and execute callback function if any |
|
155 | """release the lock and execute callback function if any | |
153 |
|
156 |
General Comments 0
You need to be logged in to leave comments.
Login now