tests/isolated/patcher_existing_locks_late.py
raw| 1 | __test__ = False |
| 2 | |
| 3 | |
| 4 | def aaa(lock, e1, e2): |
| 5 | e1.set() |
| 6 | with lock: |
| 7 | e2.wait() |
| 8 | |
| 9 | |
| 10 | def bbb(lock, e1, e2): |
| 11 | e1.wait() |
| 12 | e2.set() |
| 13 | with lock: |
| 14 | pass |
| 15 | |
| 16 | |
| 17 | if __name__ == '__main__': |
| 18 | import threading |
| 19 | import eventlet |
| 20 | eventlet.monkey_patch() |
| 21 | test_lock = threading.RLock() |
| 22 | |
| 23 | e1, e2 = threading.Event(), threading.Event() |
| 24 | a = eventlet.spawn(aaa, test_lock, e1, e2) |
| 25 | b = eventlet.spawn(bbb, test_lock, e1, e2) |
| 26 | a.wait() |
| 27 | b.wait() |
| 28 | print('pass') |