[Perlmonks-pm] Pipes for threads
Dennis Pielken
mips128 at gmx.net
Mon Jun 4 02:23:01 PDT 2007
Hello,
I've got a problem with pipes in a threaded enviroment. Because it's not possible to share a IO::Pipe object, I use IO::Handle. This is my code:
#!/usr/bin/perl
use Tk;
use threads;
use threads::shared;
use IO::Pipe;
use IO::Handle;
$|=1;
my $news = 0;
share($news);
my $pipe = IO::Handle->new();
my $thread = threads->create(\&t,$pipe);
$pipe->fdopen($pipeFileno,'r');
my $win = MainWindow->new();
$lb = $win->Listbox()->pack();
$win->repeat(100,sub{ update($pipe,$lb)});
MainLoop;
Unforunately, nothing comes out of the pipe (except \n). New items are added to the Listbox, but $tmp is empty.
what am I doing wrong?
Thanks for any help.
Bye,
Den
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
More information about the Perlmonks-pm
mailing list