Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 05cb0e982c3387afdb1d2b5f913d9e82 > files > 55

python-eventlet-doc-0.24.1-1.1.mga7.noarch.rpm

__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')