Created
November 23, 2015 18:15
-
-
Save arnsholt/26d4e5fed6062917c643 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 Net::ZMQ; | |
use Net::ZMQ::Constants; | |
use Net::ZMQ::Poll; | |
say "starting thread..."; | |
my Thread $t .= start: { | |
my Net::ZMQ::Context $c .= new; | |
my Net::ZMQ::Socket $s .= new: $c, ZMQ_REP; | |
$s.bind: "tcp://127.0.0.1:29108"; | |
device($s, $s, :queue); | |
}; | |
my Net::ZMQ::Context $c .= new; | |
my Net::ZMQ::Socket $s .= new: $c, ZMQ_ROUTER; | |
$s.bind: "tcp://127.0.0.1:29109"; | |
say "starting poll..."; | |
loop { | |
poll_one($s, 1_000_000, :in); | |
# Some stuff to trigger the GC: | |
my $sum = 0; | |
for ^100_000 { $sum += $_ } | |
say "alive $sum"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment