If you included the full error message (including the line number), I'd have a chance of knowing which thread terminated abnormally.
If you included all the source code, I might stand a chance of trying it out for myself.
If you posted the code without the line numbers, I wouldn't have to strip them off.
And your code would be far easier (for you and me) to read and analyse if it was formatted consistently.
As it is, the most obvious problem is that %clients isn't declared (or shared) anywhere.
And BTW, this %clients = ( %clients, "$client_ip:$client_port" => fileno($client) ) ; is a really horrible way to add a new key/value pair to a hash. A simple:
$clients{ "$client_ip:$client_port" } = fileno($client);
is much easier to read and far more efficient.
You've also failed to do any locking of your shared hash. (Assuming it is actually declared & shared somewhere in the code you've omitted!)
In reply to Re^7: threads with shared variables across multiple instances of a module
by BrowserUk
in thread threads with shared variables across multiple instances of a module
by fert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |