Created
March 13, 2019 05:06
-
-
Save zostay/9873b4af942f36abf4337da26df711d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6.d; | |
my Supplier $pinger .= new; | |
my Supplier $ponger .= new; | |
react { | |
say 'Beginning ping/pong...'; | |
whenever $pinger.Supply.throttle: 1, 1 { | |
.say; | |
$ponger.emit: 'pong'; | |
} | |
whenever $ponger.Supply.throttle: 1, 1 { | |
.say; | |
$pinger.emit: 'ping'; | |
} | |
whenever Promise.in(10) { | |
exit 0; | |
} | |
$pinger.emit: 'ping'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6.d; | |
my Supplier::Preserving $pinger .= new; | |
my Supplier::Preserving $ponger .= new; | |
react { | |
ENTER { | |
say 'Beginning ping/pong...'; | |
$pinger.emit: 'ping'; | |
} | |
whenever $pinger.Supply.throttle: 1, 1 { | |
.say; | |
$ponger.emit: 'pong'; | |
} | |
whenever $ponger.Supply.throttle: 1, 1 { | |
.say; | |
$pinger.emit: 'ping'; | |
} | |
whenever Promise.in(10) { | |
exit 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment