git » pymisc » master » tree

[master] / samples / adatasks / sample1.py

#!/usr/bin/env python

import time
import adatasks

@adatasks.task
def mostrador():
	print 'el mostrador!'
	while True:
		entry, params = mostrador.select()
		print entry, params
		if entry == 'quit':
			break
	print 'chau mostrador!'


def main():
	mostrador()
	adatasks.launch()
	mostrador.dale('arrancamos')
	mostrador.mostra('mostrame')
	mostrador.mostra()
	mostrador.mostra('otra mas')
	mostrador.quit('chau')
	mostrador.quit('chau')
	adatasks.wait_for_task(mostrador)
	#adatasks.wait_for_all()

if __name__ == "__main__":
	main()