Thank you for answering my question.
I have a lot of URLs and I need to check each of them if it was modified (with HEAD request) and GET its content if so. First I wrote the hole working code but it didn’t work correctly. Then I simplified my script to make code smaller and tried to localize the problem (the code I’ve posted above is simplified). But even this simple script didn’t work as I expected. As I said in first message, I run it and after 10-15 min something happens and the major number of threads freezes – they do nothing and put nothing into $result_q. I tried to decrease the number of threads and set $max_thread = 50 but result was the same. I tried to put the body of while loop into the eval block – the same result. The problem is that I don’t know the reason why threads stop after some time and how to prevent this. If you help me to solve this problem and to fix the code I’ve posted it would be easy for me to fix the main program.
I read all docs about threads in perldoc, chapters about threads in Camelbook and Lincoln Stein’s book, messages in perl.ithreads, articles of Elizabeth Mattijsen and didn’t find anything about my problem. My native language is Russian, so I asked my question on most popular perl boards but no one answered me. So, The Perl Monks is my
last hope.
P.S. May be it also will help my to improve my awful English =)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.