From mips128 at gmx.net Mon Jun 4 02:23:01 2007 From: mips128 at gmx.net (Dennis Pielken) Date: Mon, 04 Jun 2007 11:23:01 +0200 Subject: [Perlmonks-pm] Pipes for threads Message-ID: <20070604092301.276670@gmx.net> 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