Created
March 8, 2017 21:53
-
-
Save robertlemmen/56ff110b3c57b3368064e4098bc9129e to your computer and use it in GitHub Desktop.
async concurrency
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
my $done = Promise.new(); | |
my $listener = IO::Socket::Async.listen('127.0.0.1', 8080); | |
my $tap = $listener.tap( -> $client { | |
say "acepted on " ~ $*THREAD.id; | |
$client.Supply().tap(-> $input { | |
say "read input on " ~ $*THREAD.id; | |
$client.print($input); | |
sleep-until now+10; | |
say "/read $*THREAD.id; | |
}); | |
}); | |
await $done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment