New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
done() on first entry to whenever block does not exit react {} #5398
Comments
From @jonathanstoweHi, It appears that "done" in a whenever block in a react does not actually exit the react. react { whenever Supply.interval(1) -> $v { say "done"; done(); }; } will print "done" but not exit, although it would appear that the processing of other whenever blocks is blocked. If however the "done" is protect by a comparison against the value passed to the block then it does work as expected: react { whenever Supply.interval(2) -> $v { if $v == 2 {say "done"; done(); } }; whenever Supply.interval(1) { say "tick"}} And then exits the react. However if the block is protected by some other condition (that doesn't check the value supplied to the block,) then it doesn't exit the react: react { whenever Supply.interval(3) -> $v { if 1 == 1 {say "done"; done(); } }; whenever Supply.interval(1) { say "tick"}} It appears to execute the block immediately, terminate the other whenever and not exit the loop. Interestingly also if react { whenever Supply.interval(3) -> $v { if Bool.pick {say "done"; done(); } }; whenever Supply.interval(1) { say "tick"}} picks True first it doesn't exit but does it at least one "tick" block is executed. So it would appear (can you tell that I am finding more weirdness the harder I look :) that if it calls "done" on the time of its first execution then the done doesn't work correctly. This would militate against using an externally controlled Promise to execute a done for example. I'm guessing that this is tricky to test but something like: my $p = Promise.new; May help somewhat. It can all be worked around but I am sure it's not the intended behaviour. This is with the This is Rakudo version 2015.12-225-g7801920 built on MoarVM version 2015.12-29-g8079ca5 |
From @skajiI'm trying examples in https://doc.perl6.org/language/concurrency Then I find Simpler example which freezes is: My perl version is: |
From @zoffixznetDid a bit more experimenting, it seems to freeze only SOME of the time: zoffix@VirtualBox:~$ perl6 -e 'react { whenever Supply.interval: 1 { say "Run $_"; done } }' But doesn't ever freeze if done is called non-first run, even if I set a tiny delay between intervals: zoffix@VirtualBox:~$ perl6 -e 'react { whenever Supply.interval: .01 { say "Run $_"; done if $_ >= 1 } }' |
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznet♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ Skip-fudge added in Raku/roast@a047d78ac9 🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁 |
From @zoffixznetThis now appears to have been fixed by some of the recent async fixes. Tests now pass and have been unfudged in Raku/roast@92951b39ee |
From @skaji``` $ perl6 -e 'react { whenever Supply.interval(1) -> $v { say $v; done() if $v == 0 } }; say "exit"' On Wed Sep 07 10:40:14 2016, cpan@zoffix.com wrote:
|
From @jonathanstoweYep, Now to remember where it was I had hacked round this :-\ On Wed, 2016-09-07 at 10:40 -0700, Zoffix Znet via RT wrote:
|
@zoffixznet - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#128469 (status was 'resolved')
Searchable as RT128469$
The text was updated successfully, but these errors were encountered: