Skip to content

Instantly share code, notes, and snippets.

@robhaswell
Created September 23, 2011 22:22
Show Gist options
  • Save robhaswell/1238597 to your computer and use it in GitHub Desktop.
Save robhaswell/1238597 to your computer and use it in GitHub Desktop.
while True:
# XXX need to yield to
bytes = self.message_spool_file.read(1024)
if not bytes:
for protocol in protocols:
protocol.finish()
break
def worker(protocol):
print "*"*30, "Writing %s bytes" % (len(bytes),)
protocol.write(bytes)
task = cooperate(worker(protocol) for protocol in protocols)
task.start()
yield task.whenDone()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment