Can Filehandles Be Shared Between Threads?

[email protected] (Steve Schein)
Newsgroups perl.ithreads
Message-ID <1064153791.3354.20.camel@localhost>
All:

I'm having good success sharing variables across threads with the
exception of filehandles.  I have tried creating filehandles in a couple
of way including using "open $fh". This mini-simulation illustrates the
problem.

<code snipettes>

use threads;
use threads::shared;
use FileHandle;

my $fh = new FileHandle; #also tried "my $fh : shared = new FileHandle;"
my %hash : shared;
my $index;

$hash{$index} = \$fh;

results in:

"thread failed to start: Invalid value for shared scalar at module line
614, <$client> line 1."

I need to move filehandles.  Any ideas?

Best,

Steve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.