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