Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Spec Supply.(start|schedule-on), channeling jnthn++
  • Loading branch information
lizmat committed Apr 28, 2014
1 parent da4e9a6 commit 89aa2ca
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions S17-concurrency.pod
Expand Up @@ -661,14 +661,27 @@ Produces a continuous C<Supply> from a C<Supply>, in which each value is a
C<Supply>. As soon a new C<Supply> appears, it will close the current
C<Supply> and provide values from the new C<Supply>.

=item schedule_on
=item schedule-on

my $o = $s.schedule_on( $scheduler );
my $o = $s.schedule-on( $scheduler );

This allows a supply's more/done/quit to be scheduled on another
scheduler. Useful in GUI situations, for example, where the final
stage of some work needs to be done on some UI scheduler in order to
have UI updates run on the UI thread.

=item start

my $s = $s.start( {...} );

Takes a closure and, for each supplied value, schedules the closure to
run on another thread. It then more's a Supply (resulting in us having
a supply of supplies) that will either have a single value more'd and
then be done if the async work completes successfully, or quit if the
work fails. Useful for kicking off work on the thread pool if you do
not want to block up the thread pushing values at you (maybe 'cus you
are reacting to UI events, but have some long-running work to kick off).

=back

There are some others that will only publish a result or results if C<done> is
Expand Down

0 comments on commit 89aa2ca

Please sign in to comment.