Hello,

The problem I'm trying to solve is that a page request will have to
look for data from two sources: local & external. What I would like to
do is put the external lookup (which is slow) in it's own thread and
do the local processing as far as I can while waiting for the external
source. Then join the thread and do what I have to do before returning
the page.

Well, obviously this doesn't work and I end up getting "child pid
XXXXX exit signal Segmentation fault (11)" type errors.

Is my aproach completely wrong? What would be the right way to solve
this kind of a problem?

I'm trying to run this under ModPerl::Registry handler.iIn Debian
Lenny server with Apache 2.2.9, Perl 5.10.0, mod_perl 2.0.4. I've
tested with different MPM's (debian packages: apache2-mpm-prefork,
apache2-mpm-worker, apache2-mpm-event)

I've simplified my test script to:

#!/usr/bin/perl

use strict;
use warnings;

use threads;

my $t = async { sleep 2; return 123; };

print "Content-type: text/html\n\n";

my $ret = $t->join;
print "<h1>Got: $ret</h1>";

__END__

- Aku

Reply via email to