F
Frank
Hi,
I got the following script:
#!/usr/bin/perl
use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep );
use POSIX;
sub lcd_write {
local $fh = shift;
$row1 = $_[1];
$row2 = $_[2];
printf($fh "%1d%1d%-8s\n",0,0,substr($row1,0,8));
printf($fh "%1d%1d%-8s\n",1,0,substr($row2,0,8));
print "write write";
}
open(FILE,"> ./fifo") || die "DOH!! $!";
while() {
lcd_write(\*FILE,"See time",POSIX::strftime("%H:%M:%S",gmtime));
#sleep 1;
}
close(FILE);
this works fine and throws as fast as it can the time to the FIFO. But
when I activate the sleep routine, it never goes into lcd_write. (But it
IS sleeping 1 sec at the time)
I can't figure out why sleep would prevent the prints. (If I put an
other sleep in the subroutine, I can see it doing it's sleep with strace)
Can anyone figure out why the prints aren't working when using a sleep?
Regards,
Frank
I got the following script:
#!/usr/bin/perl
use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep );
use POSIX;
sub lcd_write {
local $fh = shift;
$row1 = $_[1];
$row2 = $_[2];
printf($fh "%1d%1d%-8s\n",0,0,substr($row1,0,8));
printf($fh "%1d%1d%-8s\n",1,0,substr($row2,0,8));
print "write write";
}
open(FILE,"> ./fifo") || die "DOH!! $!";
while() {
lcd_write(\*FILE,"See time",POSIX::strftime("%H:%M:%S",gmtime));
#sleep 1;
}
close(FILE);
this works fine and throws as fast as it can the time to the FIFO. But
when I activate the sleep routine, it never goes into lcd_write. (But it
IS sleeping 1 sec at the time)
I can't figure out why sleep would prevent the prints. (If I put an
other sleep in the subroutine, I can see it doing it's sleep with strace)
Can anyone figure out why the prints aren't working when using a sleep?
Regards,
Frank