Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created June 1, 2019 21:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gfldex/017ea656c81a0d9b71bd8ad13f53fdb4 to your computer and use it in GitHub Desktop.
use v6.d;
use Concurrent::Channelify;
# say $*IN.lines⇒.no-thread;
# $*IN.^can('lines')[1].wrap(my method {
# my $channel = Channel.new;
# start {
# for callsame() {
# last if $channel.closed;
# $channel.send($_)
# }
# LEAVE $channel.close unless $channel.closed;
# }
# $channel
# });
react {
whenever signal(SIGINT) {
say "Got signal";
exit;
}
whenever $*IN.lines⇒ {
say "got line";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment