Package: perl
Version: 5.8.8-6
Severity: normal

In the section "Queues: Passing Data Around" of perlthrtut, the
following snippet of code is mentioned:

           use threads;
           use Thread::Queue;

           my $DataQueue = Thread::Queue->new;
           $thr = threads->new(sub {
               while ($DataElement = $DataQueue->dequeue) {
                   print "Popped $DataElement off the queue\n";
               }
           });

           $DataQueue->enqueue(12);
           $DataQueue->enqueue("A", "B", "C");
           $DataQueue->enqueue(\$thr);
           sleep 10;
           $DataQueue->enqueue(undef);
           $thr->join;

I've saved this and run it as "foo.pl":

$ perl foo.pl 
Invalid value for shared scalar at /usr/share/perl/5.8/Thread/Queue.pm line 90.
A thread exited while 2 threads were running.

Testing shows that it's the following line that's causing the error:

           $DataQueue->enqueue(\$thr);

Commenting that line out causes the program to run fine.

I don't know whether this is a documentation bug or a code bug.

        - Andrew Sayers

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-k7
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)

Versions of packages perl depends on:
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries
ii  libdb4.4                      4.4.20-6   Berkeley v4.4 Database Libraries [
ii  libgdbm3                      1.8.3-3    GNU dbm database routines (runtime
ii  perl-base                     5.8.8-6    The Pathologically Eclectic Rubbis
ii  perl-modules                  5.8.8-6    Core Perl modules

Versions of packages perl recommends:
ii  perl-doc                      5.8.8-6    Perl documentation

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to