2005-10-11 | paulb | file changeset files shortlog | [project @ 2005-10-11 17:06:58 by paulb] Changed the name of the module from parallel to pprocess and the name of the package from parallel-module to parallel-pprocess. |
paulb@1 | 1 | #!/usr/bin/env python |
paulb@1 | 2 | |
paulb@40 | 3 | from pprocess import start |
paulb@1 | 4 | |
paulb@1 | 5 | def loop(channel, limit): |
paulb@1 | 6 | print "loop to", limit |
paulb@1 | 7 | i = channel.receive() |
paulb@1 | 8 | while i < limit: |
paulb@1 | 9 | print i |
paulb@1 | 10 | i = channel.receive() |
paulb@1 | 11 | channel.send("Done") |
paulb@1 | 12 | |
paulb@1 | 13 | if __name__ == "__main__": |
paulb@1 | 14 | limit = 100 |
paulb@1 | 15 | channel = start(loop, limit) |
paulb@1 | 16 | for i in range(0, limit + 1): |
paulb@1 | 17 | channel.send(i) |
paulb@1 | 18 | print channel.receive() |
paulb@1 | 19 | |
paulb@1 | 20 | # vim: tabstop=4 expandtab shiftwidth=4 |