def thread_2():
    while True:
        with acquire(y_lock, x_lock):
            print('Thread-2')
Esempio n. 2
0
def thread_1():

    while True:
        with acquire(x_lock):
            with acquire(y_lock):
                print('Thread-1')
def philosopher(left, right):
    while True:
        with acquire(left, right):
            print(f'{threading.currentThread()} eating')