in reply to Perl threading problem?

Two threads do run:

perl -Mthreads -E"$_->join foreach map async { say threads->tid,' ', 2 +**859433-1 } , 1..2" 1 1.#INF 2 1.#INF

So the problem is with your observation; not Perl or threading.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Perl threading problem?
by hdb (Monsignor) on Jan 17, 2014 at 14:08 UTC

    Your comment might be correct, but it could also be interpreted in the sense of the OP in that changing the subroutine changes the number of threads being used.

    From my experiments I do follow Athanasius' explanation.

      But even so, both threads do run eventually, it just takes a while before they get spawned:

      C:\test>perl -Mthreads -Mbignum -wE"$_->join foreach map async { say t +hreads->tid; 2**8-1 } , 1..2" 1 2 C:\test>perl -Mthreads -Mbignum -wE"$_->join foreach map async { say t +hreads->tid; 2**85-1 } , 1..2" 1 2 C:\test>perl -Mthreads -Mbignum -wE"$_->join foreach map async { say t +hreads->tid; 2**859-1 } , 1..2" 1 2 C:\test>perl -Mthreads -Mbignum -wE"$_->join foreach map async { say t +hreads->tid; 2**8594-1 } , 1..2" 1 2 C:\test>perl -Mthreads -Mbignum -wE"$_->join foreach map async { say t +hreads->tid; 2**85943-1 } , 1..2" 1 2 C:\test>perl -Mthreads -Mbignum -wE"$_->join foreach map async { say t +hreads->tid; 2**859433-1 } , 1..2" 1 2

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      Oh. I see. It is the use bignum that prevents it from reaching the point where the threads spawn.

      How very strange ... though it's not the first time I've seen problems caused by these overload everything in sight modules.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.