in reply to Select on STDIN or ALARM?! For Win32 doesn't work!
use threads; use threads::shared; $| ++; my $line = ""; share($line); sub read_stdin { while (<STDIN>) { lock($line); $line = $_; print "child read in: $_\n"; } } threads->create(\&read_stdin); while (1) { if ($line ne "") { lock($line); print "parent process $line\n"; $line = ""; } else { print "do something else\n"; sleep(1);#this nothing but to slow down the prints } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Select on STDIN or ALARM?! For Win32 doesn't work!
by gmpassos (Priest) on Dec 27, 2002 at 19:33 UTC | |
by pg (Canon) on Dec 27, 2002 at 21:27 UTC | |
by gmpassos (Priest) on Dec 27, 2002 at 21:44 UTC |