in reply to Re^2: Win32 and threads;
in thread Win32 and threads;

Thanks to all!!

BrowserUk you nailed it...

I just ran the sample code against
5.8.3 and works fantastic.... 5.8.1 is not thread stable

Thanks again

--jammin

Replies are listed 'Best First'.
Re^4: Win32 and threads;
by jammin2night (Initiate) on Jul 11, 2004 at 15:09 UTC
    Note: this code works fine under
    v5.8.4 built for i386-freebsd-thread-multi-64int

    I'm testing with
    v5.8.4 built for MSWin32-x86-multi-thread - build 810 (activestate)

    When I execute the following code if $thread_sleep = "50" my application
    dies at threads_count == 119 religiously..

    It exits with NO ERROR !!

    if $thread_sleep = "3" then $thread_count reaches it's goal and exits...
    I assume this is because older threads are exiting sooner

    Is there a limit of threads per process under Win32 ??

    Why don't I get any error ??

    I'm using Windows 2000 - Build 2195 SP4 + patches

    Thanks!
    use strict; use warnings; use threads; my $thread_sleep = "50"; my $thread_count = "0"; for (1..5000) { threads->new(\&handle_thread,++$thread_count); } sleep 10; print "--Parent Quits --"; ###################### sub handle_thread { my $thread_count = shift; threads->self->detach; # so long parent print "You are thread number $thread_count \n"; sleep $thread_sleep; }
    --jammin

      There is (currently) a limit of 120 threads per process (on win32/5.8.4/XP/my computer/11th July 2004/SE UK etc :). This is not a hard-wired limit within perl and may vary with build.

      That you are not seeing any error message suggests that your installation is not configured to report segfaults. There is an option to "Send Administrative Alert" in Control panel->System->Advanced->Startup and Recovery->Settings->System failure. At least that's where it is on XP.

      That perl is not detecting the underlying problem and reporting it's own message is a bug. I have tracked down the unchecked API call and will submit a perlbug with the information.

      However, if you can show me a useful application of using more than half a dozen or so simultaneous threads, I'll show you a better way :)

      Update: Perlbug # 30674.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

        However, if you can show me a useful application of using more than half a dozen or so simultaneous threads, I'll show you a better way :)
        I don't mean to disagree with this - in fact I think you're right, but I would be very interested to read an elaboration on this claim from you. Would you?