Esempio n. 1
0
def philosopher(left, right):
    while True:
        with acquire(left, right):
            print(threading.currentThread(), 'eating')
Esempio n. 2
0
def thread_2():
    while True:
        with acquire(y_lock):
            with acquire(x_lock):
                print("Wątek-2")
                time.sleep(1)
Esempio n. 3
0
def thread_1():
    while True:
        with acquire(x_lock):
            with acquire(y_lock):
                print("Thread-1")
                time.sleep(1)
Esempio n. 4
0
def thread_2():
    while True:
        with acquire(y_lock, x_lock):
            print('Trhead-2')
Esempio n. 5
0
def thread_1():
    while True:
        with acquire(x_lock, y_lock):
            print('Thread-1')
Esempio n. 6
0
def thread_1():
    while True:
        with acquire(x_lock):
            with acquire(y_lock):
                print("Thread-1")
                time.sleep(1)
Esempio n. 7
0
def thread_2():
    while True:
        with acquire(y_lock, x_lock):
            print("Thread-2")
            time.sleep(1)
Esempio n. 8
0
def philosopher(left, right):
    while True:
        with acquire(left, right):
            print(threading.currentThread(), 'eating')
Esempio n. 9
0
def thread_1():
    while True:
        with acquire(x_lock, y_lock):
            print("Thread-01")
Esempio n. 10
0
def thread_2():
    while True:
        with acquire(y_lock, x_lock):
            print("Thread-2")
Esempio n. 11
0
def thread_1():
    while True:
        with acquire(x_lock, y_lock):
            print("Wątek-1")
Esempio n. 12
0
def thread_2():
    while True:
        with acquire(y_lock, x_lock):
            print("Wątek-2")