pprocess

tests/two_way.py

149:eeaa043dbfb1
2008-06-04 paulb [project @ 2008-06-04 22:13:31 by paulb] Added a link to the reference document.
     1 #!/usr/bin/env python     2      3 import pprocess     4      5 class Ex(pprocess.Exchange):     6     def store_data(self, channel):     7         data = channel.receive()     8         print "Parent:", data     9         channel.send(data - 1)    10         print "Parent sent"    11     12 def child(channel, data):    13     while data != 0:    14         print "Child:", data    15         channel.send(data)    16         print "Child sent"    17         data = channel.receive()    18     19 ex = Ex()    20 ex.add(pprocess.start(child, 20))    21 ex.finish()    22     23 # vim: tabstop=4 expandtab shiftwidth=4