diff options
| author | Mattias Andrée <maandree@operamail.com> | 2014-03-07 23:24:21 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2014-03-07 23:24:21 +0100 |
| commit | a8259cf1e54830287aeac0b1c6bec46d8696bbbd (patch) | |
| tree | 8f368a8eb204afde95fe5f4ec12e6703f29bb3f2 | |
| parent | m (diff) | |
| download | join-python-a8259cf1e54830287aeac0b1c6bec46d8696bbbd.tar.gz join-python-a8259cf1e54830287aeac0b1c6bec46d8696bbbd.tar.bz2 join-python-a8259cf1e54830287aeac0b1c6bec46d8696bbbd.tar.xz | |
info: concurrently
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rw-r--r-- | info/join-python.texinfo | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/info/join-python.texinfo b/info/join-python.texinfo index e6f7b39..df311eb 100644 --- a/info/join-python.texinfo +++ b/info/join-python.texinfo @@ -54,6 +54,7 @@ Texts. A copy of the license is included in the section entitled * Signals:: The signal construct. * Fragments:: The fragment join construct. * Join-switches:: Advanced joining techniques. +* Fork–merge:: Running multiple functions concurrently synchronously * GNU Free Documentation License:: Copying and sharing this manual. @end menu @@ -269,6 +270,44 @@ that fragment group. +@node Fork–merge +@chapter Fork–merge + +As an extension to join-calculus Join Python offers +a blocking function that runs multiple functions +in parallel. @code{concurrently} takes any number +of functions and executes them in parallel and waits +for all of them to return. Functions that are +signals (@code{@@signal} or @code{@@puresignal}) +will have there return value returned by +@code{concurrently}. + +@cartouche +@example +>>> from join import * +>>> +>>> @@signal +>>> def sig(value = 4): +>>> print('In parallel') +>>> return value ** 2 +>>> +>>> def fun(value): +>>> print('In parallel') +>>> return value ** 3 +>>> +>>> print(concurrently(signal(lambda : sig(2).join()), lambda : fun(3))) +In parallel +In parallel +[4, None] # it is actually undefined where we get `None` here +>>> print(concurrently(sig, signal(lambda : fun(3)))) +In parallel +In parallel +[16, 27] +@end example +@end cartouche + + + @node GNU Free Documentation License @appendix GNU Free Documentation License @include fdl.texinfo |
