| 171 | # |
| 172 | |
| 173 | class Lock(SemLock): |
| 174 | |
| 175 | def __init__(self, *, ctx): |
| 176 | SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx) |
| 177 | |
| 178 | def __repr__(self): |
| 179 | try: |
| 180 | if self._semlock._is_mine(): |
| 181 | name = process.current_process().name |
| 182 | if threading.current_thread().name != 'MainThread': |
| 183 | name += '|' + threading.current_thread().name |
| 184 | elif not self._semlock._is_zero(): |
| 185 | name = 'None' |
| 186 | elif self._semlock._count() > 0: |
| 187 | name = 'SomeOtherThread' |
| 188 | else: |
| 189 | name = 'SomeOtherProcess' |
| 190 | except Exception: |
| 191 | name = 'unknown' |
| 192 | return '<%s(owner=%s)>' % (self.__class__.__name__, name) |
| 193 | |
| 194 | # |
| 195 | # Recursive lock |
no outgoing calls
no test coverage detected
searching dependent graphs…