Re: Threads mess with simple HTTP daemon

[email protected] ("Jerry D. Hedden") Fri, 15 Jun 2007 10:39:07 -0400
Newsgroups perl.ithreads
Message-ID <[email protected]>
Arno Velds wrote:
> Still, I don't even remotely understand why the exiting of the image
> thread has any relation with the browser timeout on this weird form of
> HTTP/1.0 - HTTP/1.1 miscommunication.

It's because the thread still has the socket open.  If you pass the
socket to the thread:
    threads->create("image_thread", $hybid, $c)->detach;

And then close it in the thread:
    sub image_thread {
        my $hybid = shift;
        my $socket = shift;
        $socket->close();
        ...

You don't get that problem.