From f1c0281f0827699b5990c5dd21908d2384407578 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 2 Apr 2008 23:02:59 +0200 Subject: * host/proto: - added proto interface. --- host/proto/test/interactive.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 host/proto/test/interactive.py (limited to 'host/proto/test/interactive.py') diff --git a/host/proto/test/interactive.py b/host/proto/test/interactive.py new file mode 100644 index 00000000..f68dd121 --- /dev/null +++ b/host/proto/test/interactive.py @@ -0,0 +1,29 @@ +import sys +sys.path.append (sys.path[0] + '/..') + +import proto +from fio import IO +import time, select + +def log (x): + print x + +p = proto.Proto (IO (), time.time, 2, log) + +def a (i, j): + print 'a (%d, %d)' % (i, j) + +def b (i): + print 'b (%d)' % i + +p.register ('a', 'BH', a) +p.register ('b', 'L', b) + +p.send ('a', 'BH', 1, 2) +p.send ('b', 'L', 3) + +while True: + p.sync () + fds = select.select ((p,), (), (), 0.1)[0] + for i in fds: + i.read () -- cgit v1.2.3