Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
0c573d0e
Commit
0c573d0e
authored
Sep 28, 2017
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up select examples even more.
parent
e624295d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
docs/api.rst
docs/api.rst
+5
-7
docs/index.rst
docs/index.rst
+1
-2
No files found.
docs/api.rst
View file @
0c573d0e
...
...
@@ -76,10 +76,9 @@ contexts.
total = 0
recvs = [c.call_async(long_running_operation) for c in contexts]
with mitogen.master.Select(recvs) as select:
for recv, (msg, data) in select:
print 'Got %s from %s' % (data, recv)
total += data
for recv, (msg, data) in mitogen.master.Select(recvs):
print 'Got %s from %s' % (data, recv)
total += data
# Iteration ends when last Receiver yields a result.
print 'Received total %s from %s receivers' % (total, len(recvs))
...
...
@@ -108,9 +107,8 @@ contexts.
])
]
with mitogen.master.Select(selects) as select:
for _, (msg, data) in select:
print data
for recv, (msg, data) in mitogen.master.Select(selects):
print data
.. py:method:: get (timeout=None)
...
...
docs/index.rst
View file @
0c573d0e
...
...
@@ -269,8 +269,7 @@ available.
for name in dirnames + filenames), 0)
total = 0
for recv, msg in Select(c.call_async(usage, '/tmp') for c in contexts):
value = result.unpickle()
for recv, (msg, value) in Select(c.call_async(usage, '/tmp') for c in contexts):
print 'Context %s /tmp usage: %d' % (recv.context, value)
total += value
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment