Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 40 lines (29 sloc) 0.587 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#currently hangs when put under much load

use strict;
use warnings;

use Acme::Threads;
use IO::File;
use Time::HiRes qw(setitimer ITIMER_REAL);

#unhangs the system, weird
$SIG{ALRM} = sub { };
setitimer(ITIMER_REAL, 1, 1);

my $input = Acme::Threads->spawn('Input', 'new');

#this leaks objects
#while(defined(my $line = $input->fh->getline)) {
# print $line;
#}

#but this leaks less
while(1) {
my $fh = $input->fh;
my $line = $fh->getline;

print $line;
}

package Input;

use strict;
use warnings;

sub new {
return bless({}, $_[0]);
}

sub fh {
return \*STDIN;
}
Something went wrong with that request. Please try again.