예제 #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")