Esempio n. 1
0
def barber(door, printer):
    import random
    timer = Timer()
    while True:
        printer.write('Barber is sleeping.')
        customer = door.read()
        print_c.write('The barber has woken to give {0} a shave.'.format(customer))
        timer.sleep(random.random() * 5)
Esempio n. 2
0
def sendAlt(cout, num):
    """
    readset =
    writeset = cout
    """
    t = Timer()
    t.sleep(1)
    cout.write(num)
    return
Esempio n. 3
0
def barber(door, printer):
    import random
    timer = Timer()
    while True:
        printer.write('Barber is sleeping.')
        customer = door.read()
        print_c.write(
            'The barber has woken to give {0} a shave.'.format(customer))
        timer.sleep(random.random() * 5)
Esempio n. 4
0
def sendAlt(cout, num):
    """
    readset =
    writeset = cout
    """
    t = Timer()
    t.sleep(1)
    cout.write(num)
    return
Esempio n. 5
0
def hello():
    t = Timer()
    for i in range(5):
        print i
        t.sleep(1)