git » pymisc » master » tree

[master] / samples / adatasks / sample2.py

#!/usr/bin/env python

import time
import adatasks

@adatasks.task
def f():
	print 'launch f'
	params = f.accept("entry1")
	print params[0]

	params = f.accept("entry2")
	print params

	#raise "err"

	entry, params = f.select("entry3", "entry4")
	print entry, params



def main():
	adatasks.launch()
	f.entry1('Hello')
	f.entry2()
	f.entry3('World')

	f.entry1('Vamos')
	f.entry2('de')
	f.entry3('nuevo')

if __name__ == "__main__":
	main()
	f()

	print 'wait for f'
	adatasks.wait_for_task(f)

	print 'wait for all'
	adatasks.wait_for_all()

	print 'bye'