Skip to content

Instantly share code, notes, and snippets.

@arnsholt
Created November 23, 2015 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnsholt/26d4e5fed6062917c643 to your computer and use it in GitHub Desktop.
Save arnsholt/26d4e5fed6062917c643 to your computer and use it in GitHub Desktop.
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