in reply to Threaded sockets, etc.

Why do you expect the error being in the code you posted?

Q: Hey, what are you doing here at the lantern?
A: Lost my keys, searching.
Q: Where did you loose them?
A: Over there, in the dark.
Q: Then why are you searching here?
A: 'cause it's bright here.

Post surrounding code. The dark stuff: threading sockets...

Replies are listed 'Best First'.
Re^2: Threaded sockets, etc.
by daveb (Initiate) on Aug 29, 2008 at 18:40 UTC
    Oh I forgot to mention that when it's not a timeout, when it's a proper disconnect, everything works fine and gets EOF and exits properly, the thread dies properly, etc. Basically it's just
    while(1) { while (my $connection = $main->accept) { threads->create(\&initplayer,$connection); }
    then
    sub initplayer { my $hand = shift; $hand->blocking(0); print "INITPLAYER CALLED!\n"; threads->detach; doplayer($hand,$hand,$hand); remove_player($hand); print "THREAD DESTROYED!\n"; $hand->close(); }
    and doplayer contains the code I posted before. I added a print line inside the while loop and it continues to print after the timeout, so it's not a blocking issue.