Re: sharing & streams

[email protected]
Newsgroups perl.ithreads
Message-ID <[email protected]>
it seems like i can use the fileno() method
and later some IO::Handle 's method fdopen()

they seemed to work almost as i expected, i continue
some experimenting with them ... still can't properly 
figure out how to build the blocking mechanisms i'll need :(
it needs a lot long vision of the rest of the app



[sleepless night on the way :D]

#smth like this seemed to work, ugly code, i know
#just for '#%^&!!' testing 

my $x_fd; 
open(ILUS,'<test.txt');

$x_fd = fileno(ILUS);

$shareable_v = $x_fd;

my $t1 = threads->create(\&demosub,$shareable_v);

#....

sub demosub {
	my $x1 = shift;	
	my $io = new IO::Handle;
	my $x5 = $io->fdopen($x1,'r');
	print "sub IZ here ".Dumper($x5)."\n";
	my $g1 = '';
	$x5->sysread($g1,8,0);
	print "read this : '$g1' \n";
	$x5->close();
}

#seemed to work
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.