in reply to threaded TCP server problem
Hmm, looks like there's a leak with detach. A workaround is to narrow the scope of $tid, iemy ($thr,$tid); ... while ((!($tid = threads->tid()))&&(my $client = $socket->accept)) { $thr = threads->create(\&process_request,$client);
otherwise when you re-enter the loop, the old value in $thr is still there, and gets cloned into the newly-created thread.while ((!($tid = threads->tid()))&&(my $client = $socket->accept)) { my $thr = threads->create(\&process_request,$client);
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: threaded TCP server problem
by Anonymous Monk on Mar 27, 2006 at 12:13 UTC |