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)
def sendAlt(cout, num): """ readset = writeset = cout """ t = Timer() t.sleep(1) cout.write(num) return
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)
def hello(): t = Timer() for i in range(5): print i t.sleep(1)