develooper Front page | perl.perl6.users | Postings from April 2022

Re: Help with promises, supplies and channels.

Thread Previous | Thread Next
From:
William Michels via perl6-users
Date:
April 5, 2022 19:55
Subject:
Re: Help with promises, supplies and channels.
Message ID:
CAA99HCw0acGxLjOWpgZvQLJs7aaEe=aj8ktGRhx3M704pX7zsg@mail.gmail.com
Thanks for the bash loop. I'm seeing a few hangs, also some errors returned
saying:

"Unhandled exception in code scheduled on thread 4"

(MacOS 11.11)

On Tue, Apr 5, 2022 at 12:47 PM David Emanuel da Costa Santiago <
demanuel@gmail.com> wrote:

>
> Hi William,
>
> when it fails or hangs it doesn't print the last line.
>
> Please check attached file for output of the stack.
>
> Since the failures are random, it's easier to invoke it in a loop:
>
> bash$ for i in $(seq 100); do raku test.raku; done
>
> If nothing is wrong with the code, i'll open a bug in the github.
>
> Regards,
> David Santiago
>
>
> Às 21:37 de 05/04/22, William Michels escreveu:
> > No problems so far.
> >
> > say $*VM; #add as last line, returns:
> > moar (2021.06)
> >
> > On Tue, Apr 5, 2022 at 11:06 AM David Emanuel da Costa Santiago
> > <demanuel@gmail.com <mailto:demanuel@gmail.com>> wrote:
> >
> >     Hi,
> >
> >
> >
> >     I'm trying to learn about promises, supplies and channels. So i made
> >     this code:
> >
> >     """
> >
> >     my $p1 = Supply.interval(5);
> >     my $p2 = Supply.interval(2);
> >     my Channel $ch = Channel.new;
> >
> >     my $prom = start react {
> >           whenever $p1 -> $interval {
> >               say "5";
> >           }
> >
> >           whenever $p2 -> $interval {
> >               say 2;
> >           }
> >
> >           whenever $ch.closed {
> >               done;
> >           }
> >
> >           whenever $ch -> $data {
> >               say "Data: $data";
> >           }
> >     }
> >
> >     my $prom2 = start react {
> >           whenever $p1 -> $interval {
> >               $ch.send("5.2");
> >               $ch.close;
> >           }
> >           whenever $ch.closed {
> >               done;
> >           }
> >     }
> >
> >     my @proms = ($prom, $prom2);
> >     await Promise.allof(@proms);
> >
> >     """
> >
> >
> >
> >     I don't see anything wrong with this but most of the times runs fine,
> >     sometimes hangs, sometimes throw exception. Am i doing something
> that i
> >     shouldn't be doing?
> >
> >     $ raku --version
> >     Welcome to Rakudo™ v2022.03-130-g8f7cc0847.
> >     Implementing the Raku® Programming Language v6.d.
> >     Built on MoarVM version 2022.03-13-ga3476e286.
> >
> >
> >
> >     Regards,
> >     David Santiago
> >

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About