File: patcher_existing_locks_late.py

package info (click to toggle)
python-eventlet 0.26.1-7%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,916 kB
  • sloc: python: 24,898; makefile: 98
file content (28 lines) | stat: -rw-r--r-- 489 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
__test__ = False


def aaa(lock, e1, e2):
    e1.set()
    with lock:
        e2.wait()


def bbb(lock, e1, e2):
    e1.wait()
    e2.set()
    with lock:
        pass


if __name__ == '__main__':
    import threading
    import eventlet
    eventlet.monkey_patch()
    test_lock = threading.RLock()

    e1, e2 = threading.Event(), threading.Event()
    a = eventlet.spawn(aaa, test_lock, e1, e2)
    b = eventlet.spawn(bbb, test_lock, e1, e2)
    a.wait()
    b.wait()
    print('pass')