exodist has asked for the wisdom of the Perl Monks concerning the following question:

When I run my perl script that uses threads I get the following error, a google search shows only 2 results, 1 is russian and I can't read it, the other is a blog that no longer seems to have the issue listed.

Can't locate auto/threads/is_joinable.al in @INC (@INC contains: /etc/ +perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /us +r/lib64/perl5/vendor_perl/5.8.8 /usr/lib64/perl5/vendor_perl /usr/lib +64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/s +ite_perl/5.8.8 /usr/lib64/perl5/site_perl /usr/lib64/perl5/5.8.8/x86_ +64-linux-thread-multi /usr/lib64/perl5/5.8.8 /usr/local/lib/site_perl + .) at ./OEFS.pl line 32

Currently I am trying to make sockets and threads work as I intend before writing the rest of the code, so it is a pretty simple script so far.
here is OEFS.pl:
#!/usr/bin/perl use strict; use IO::Socket::UNIX; use threads; use threads::shared; my $LSocket; my @Links; my $NumConnections = 32; #allow for 32 connections my @Connections = (1 .. $NumConnections); my @StructDs : shared; my @StoreDs : shared; sub ConThread($); MAIN: { die("The first and only requirement should be the name for this OE +FS instance, and is required!\n") if (!($ARGV[0])); #Start the listener mkdir("/tmp/OEFS/") if (!(-e "/tmp/OEFS")); unlink('/tmp/OEFS/' . $ARGV[0]); $LSocket = new IO::Socket::UNIX('Listen' => 1, 'Local' => '/tmp/OE +FS/' . $ARGV[0]); die("$!\nUnable to create listen socket!\n") if (!($LSocket)); my $Link; my $IDX; print("Listening...\n"); while ($Link = $LSocket->accept()) { #Clean out old threads foreach my $I (1 .. $NumConnections) { if (($Links[$I]) && ($Links[$I]->is_joinable())) { $Links[$I]->join(); unshift(@Connections, $I); print("Connection #$I now free\n"); } } print("Incomming Connection\n"); $IDX = pop(@Connections); if ($IDX) { print("Using connection #$IDX\n"); print("Spawning Thread\n"); #New thread. $Links[$IDX] = threads->create(\&ConThread, $Link); } else { print("Too many connections\n"); print $Link "Maximum number of connections has been reache +d.\n"; $Link->close(); } } } sub ConThread($) { my ($Socket) = @_; print $Socket "Ready\n"; $Socket->close(); return; }

here is the program I am using to access OEFS.pl through the socket, the error occurs when I run it a second time to make sure the first connection is cleared:
#!/usr/bin/perl use strict; use IO::Socket::UNIX; my $TheSocket; MAIN: { die("The first and only requirement should be the name of the OEFS + instance, and is required!\n") if (!($ARGV[0])); $TheSocket = new IO::Socket::UNIX('Peer' => '/tmp/OEFS/' . $ARGV[0 +]) || die("$!\nUnable to connect!"); print "Socket says: " . <$TheSocket> . "\n"; $TheSocket->close(); exit(0); }

Replies are listed 'Best First'.
Re: threads, is_joinable issue.
by Joost (Canon) on Jul 01, 2007 at 22:51 UTC
      Thank you, I updated threads and it works now.
Re: threads, is_joinable issue.
by cosmicperl (Chaplain) on Jul 01, 2007 at 22:52 UTC
    Hi,
      I haven't used threads before, but your problem is either is_joinable is not a function of threads. Or your version of threads does not include is_joinable. So I recommend that you upgrade your version of "threads.pm" to the latest one avilable at cpan. Make sure you do a proper install using perl -MCPAN -e shell; orby downloading and installing the zip, don't just copy and paste threads.pm.

    Lyle Hopkins
Re: threads, is_joinable issue.
by afarber (Initiate) on Jan 10, 2012 at 12:07 UTC
    Why not use Io::Poll instead of threads?

      Why not use Io::Poll instead of threads?

      Because you don't get the benefits of threads? :)

      Maybe I misunderstood your question, but its kind of like asking a carpenter holding a fist full of nails: why not use screwdriver?

      :)

      Hi, new questions go in Seekers Of Perl Wisdom

      exodist, whom you asked a question, hasn't been here in 3 years.

      The node to which you replied is 5 years old.

      Bye