RE: Activestate 5.8.1 build 807

I started working on my first threaded perl application
and I have a problem where it would randomly exit without error

Here is some sample code that just fires up some detached
threads... it exhibits this behaviour

Whats really interesting is that $thread_count may only make it to
30 or it may make it to 700+ before the application
just exits without error... but at 700+ process monitor
only shows 3-4 threads for perl.exe

This value should be much higher based on the sleep values
in the parent and the thread handler --- right???

I'm obviously missing something...

Don't grill me too hard :-)
Thanks!!!
use strict; use warnings; use threads; my $thread_count = 0; while (1) { threads->new(\&handle_thr +ead,++$thread_count); sleep .1; } sub handle_thread { my $thread_count = shift; threads->self->detach; # so long parent print "You are thread number $thread_count \n"; sleep .2; }
--jammin

In reply to Win32 and threads; by jammin2night

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.