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