in reply to Re^13: Monitor list of threads running
in thread Monitor list of threads running

Hi Corion

I installed this latest threads into a directory and wrote following code and still get this error message?

Can't locate auto/threads/is_running.al in @INC (@INC contains: /nss/nfx/thread_libs/lib/ ....

Would you know why? Is there a way I can tell what version of threads package it is using?

#!/usr/bin/perl use lib "/ssy/nos/thread_libs/lib/"; use threads; my @threads; for (0 ..3) { my $thr = threads->create( sub { sleep 2; } ); $thr->detach(); push @threads, $thr; } # then later for my $thr ( @threads ) { print 'Thread ', $thr->tid, $thr->is_running() ? ' is running' : ' + is not running'; }

Replies are listed 'Best First'.
Re^15: Monitor list of threads running
by Corion (Patriarch) on Apr 09, 2010 at 15:34 UTC

    Again, going back to where we already were, you can use the following snippet:

    perl -Mthreads -e 'use lib "/ssy/nos/thread_libs/lib/";die $threads::V +ERSION'

    ... or you can output the version information from your script:

    use threads; print "Using threads.pm version $threads::VERSION\n";

      I am still getting version 1.07 for threads.pm

      Here is what I did to install latest threads.

      1. downloaded threads-1.77.tar.gz 2. untared into /ssy/nos/threads_lib 3. cd /ssy/nos/threads_lib/threads-177 4. perl Makefile.PL PREFIX=/ssy/nos/threads_libs/lib 5. make 6. make test 7. make install 8. perl -Mthreads -e 'use lib "/ssy/nos/thread_libs/lib/";die $threads +::VERSION' I get: 1.07 at -e line 1.

      I also checked that threads.pm exist at location:

      /ssy/nos/thread_libs/lib/lib64/perl5/5.8.8/x86_64-linux-thread-multi/

      OK I finally got it working.

      gambit$ perl -Mthreads -e 'use lib "/ssy/nos/thread_libs/lib/lib64/per +l5/5.8.8/x86_64-linux-thread-multi/";die $threads::VERSION' I got 1.07 at -e line 1

      But If I run this. I get correct message

      #!/usr/bin/perl use lib "/ssy/nos/thread_libs/lib/lib64/perl5/5.8.8/x86_64-linux-threa +d-multi/"; use threads; print "Using threads.pm version $threads::VERSION\n"; Output: Using threads.pm version 1.77

      oh and also If I include path up to /ssy/nos/thread_libs/lib/lib64/ in perl script I get 1.07.

      Never the less I got it with you help. thanks so much again.

        Had you done:

        perl -Mlib=/ssy/nos/thread_libs/lib/lib64/perl5/5.8.8/x86_64-linux-thr +ead-multi/ -Mthreads -e 'die $threads::VERSION'

        The lib path would have been added to before the thread module was loaded, and it would work.


        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.