Perlthrtut threadqueue example : possibly incorrect ?
- From: klestes@xxxxxxxxx
- Date: 28 Nov 2006 08:31:34 -0800
Messing with the example relating to the Thread::Queue, which is :
use threads;
use threads::shared;
use Thread::Queue;
my $DataQueue = new Thread::Queue;
$thr = async {
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;
And I get an "invalid value for shared scalar". After further messing
around, discovered it works OK if I remove the following line:
$DataQueue->enqueue(\$thr);
So my question is: Wha ?
(Win32/ActiveState 5.8.7 in da house)
.
- Follow-Ups:
- Prev by Date: Re: regex matching exactly 10 digits
- Next by Date: Re: Perlthrtut threadqueue example : possibly incorrect ?
- Previous by thread: FAQ 2.1 What machines support perl? Where do I get it?
- Next by thread: Re: Perlthrtut threadqueue example : possibly incorrect ?
- Index(es):