Commit 0c573d0e authored by David Wilson's avatar David Wilson

Tidy up select examples even more.

parent e624295d
...@@ -76,8 +76,7 @@ contexts. ...@@ -76,8 +76,7 @@ contexts.
total = 0 total = 0
recvs = [c.call_async(long_running_operation) for c in contexts] recvs = [c.call_async(long_running_operation) for c in contexts]
with mitogen.master.Select(recvs) as select: for recv, (msg, data) in mitogen.master.Select(recvs):
for recv, (msg, data) in select:
print 'Got %s from %s' % (data, recv) print 'Got %s from %s' % (data, recv)
total += data total += data
...@@ -108,8 +107,7 @@ contexts. ...@@ -108,8 +107,7 @@ contexts.
]) ])
] ]
with mitogen.master.Select(selects) as select: for recv, (msg, data) in mitogen.master.Select(selects):
for _, (msg, data) in select:
print data print data
.. py:method:: get (timeout=None) .. py:method:: get (timeout=None)
......
...@@ -269,8 +269,7 @@ available. ...@@ -269,8 +269,7 @@ available.
for name in dirnames + filenames), 0) for name in dirnames + filenames), 0)
total = 0 total = 0
for recv, msg in Select(c.call_async(usage, '/tmp') for c in contexts): for recv, (msg, value) in Select(c.call_async(usage, '/tmp') for c in contexts):
value = result.unpickle()
print 'Context %s /tmp usage: %d' % (recv.context, value) print 'Context %s /tmp usage: %d' % (recv.context, value)
total += value total += value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment