in reply to Re: Placing references onto thread queues (Perl 5.8)
in thread Placing references onto thread queues (Perl 5.8)

#!/opt/perl-5.8.2/bin/perl -w use threads; use Thread::Queue; $queue = new Thread::Queue; $queue->enqueue("foo"); ## Works ok $queue->enqueue("bah"); ## Works ok $text = "eeek"; $text_ref = \$text; $queue->enqueue($text); ## Works ok $queue->enqueue($text_ref); ## Does not work

Replies are listed 'Best First'.
Re: Re: Placing references onto thread queues (Perl 5.8)
by fx (Pilgrim) on Dec 16, 2003 at 13:10 UTC
    Ok, it works if I remove "use threads;"...
      No, it doesn't.

      By removing use threads, you are basically disabling shared variables, making the process of sharing a variable a noop.

      What you have without use threads is a very expensive, object oriented way of pushing and popping an array in a single process.

      Liz