K
klestes
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)
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)