Debian Codegraph @

tests/isolated/patcher_existing_locks_unlocked.py

raw
1 __test__ = False
2
3
4 def take(lock, e1, e2):
5 with lock:
6 e1.set()
7 e2.wait()
8
9
10 if __name__ == '__main__':
11 import sys
12 import threading
13 lock = threading.RLock()
14 import eventlet
15 eventlet.monkey_patch()
16
17 lock.acquire()
18 lock.release()
19
20 e1, e2 = threading.Event(), threading.Event()
21 eventlet.spawn(take, lock, e1, e2)
22 e1.wait()
23 assert not lock.acquire(blocking=0)
24 e2.set()
25 print('pass')