in reply to threads and queues

I don't see why you can't create a queue for every thread. Something like
my %listerners; sub create_new_listener { my ($param) = @_; my $queue = Thread::Queue->new(); my $thread = threads->new(\&listen, $param, $queue); $listeners{$param} = [ $thread, $queue ]; }

If you need to send something to a worker, lookup its queue.

Replies are listed 'Best First'.
Re^2: threads and queues
by morgon (Priest) on Apr 02, 2009 at 21:49 UTC
    Nice.

    Embarrassingly obvious when I think about it ... maybe I should start the habit of thinkig for myself before I bother my fellow monks ...

    But anyway: Thanks a lot.

    (and of couse you have to add a ": shared" for the %listeners).