Why they stop?
Because your running too many threads.
And because your code is badly structured. This is an endless loop that does nothing useful.
while (1) { my $url = $task_q->dequeue(); my $ua = LWP::UserAgent->new(timeout => 3); my $res = $ua->request(HEAD $url); $result_q->enqueue( "$tid;$url;" . $res->code() . ";" . $res->message() . ";" ); }
All your code does is prove that if you write badly structured code and run gazillions of threads, you can induce non-useful behaviour.
This is the problem, I’m trying to solve...
The solution is simple: Don't do that! Don't run large numbers of threads. Don't run endless, pointless loops within threads.
All the code you have provided this time is a snippet of the same code from your original post, which you already said was test code--which I cannot correct, because it doesn't do anything useful.
In reply to Re^4: Problem with ithreads
by BrowserUk
in thread Problem with ithreads
by 2NetFly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |