mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
...
This commit is contained in:
parent
da38d6cca9
commit
62e418f3f7
@ -214,14 +214,16 @@ if __name__ == '__main__':
|
||||
def test_multithread_deadlock(self):
|
||||
lock = SHLock()
|
||||
def two_shared():
|
||||
lock.acquire(shared=True)
|
||||
time.sleep(0.2)
|
||||
lock.acquire(blocking=True, shared=True)
|
||||
lock.release()
|
||||
lock.release()
|
||||
r = RWLockWrapper(lock)
|
||||
with r:
|
||||
time.sleep(0.2)
|
||||
with r:
|
||||
pass
|
||||
def one_exclusive():
|
||||
time.sleep(0.1)
|
||||
lock.acquire(blocking=True, shared=False)
|
||||
w = RWLockWrapper(lock, is_shared=False)
|
||||
with w:
|
||||
pass
|
||||
threads = [Thread(target=two_shared), Thread(target=one_exclusive)]
|
||||
for t in threads:
|
||||
t.daemon = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user