Revision 008b92fa lib/locking.py
b/lib/locking.py | ||
---|---|---|
536 | 536 |
|
537 | 537 |
return False |
538 | 538 |
|
539 |
def acquire(self, shared=0, timeout=None): |
|
539 |
def acquire(self, shared=0, timeout=None, test_notify=None):
|
|
540 | 540 |
"""Acquire a shared lock. |
541 | 541 |
|
542 | 542 |
@type shared: int |
... | ... | |
544 | 544 |
exclusive lock will be acquired |
545 | 545 |
@type timeout: float |
546 | 546 |
@param timeout: maximum waiting time before giving up |
547 |
@type test_notify: callable or None |
|
548 |
@param test_notify: Special callback function for unittesting |
|
547 | 549 |
|
548 | 550 |
""" |
549 | 551 |
self.__lock.acquire() |
550 | 552 |
try: |
553 |
# We already got the lock, notify now |
|
554 |
if __debug__ and callable(test_notify): |
|
555 |
test_notify() |
|
556 |
|
|
551 | 557 |
return self.__acquire_unlocked(shared, timeout) |
552 | 558 |
finally: |
553 | 559 |
self.__lock.release() |
Also available in: Unified diff