in reply to Re: How do I queue perl subroutines to a thread queue instead of data?
in thread How do I queue perl subroutines to a thread queue instead of data?

Thanks for your reply! OK I think I'm starting to get it... are you saying that I never thread->create but instead only $conn_q->enqueue in the #main?

In other words, my $conc_q = thread::queue->new() would exist at the top and no thread->create would exist anywhere because the enqueue replaces it?
  • Comment on Re^2: How do I queue perl subroutines to a thread queue instead of data?

Replies are listed 'Best First'.
Re^3: How do I queue perl subroutines to a thread queue instead of data?
by Random_Walk (Prior) on Apr 25, 2013 at 15:06 UTC

    No Sorry! you still need to thread->create! Just make a thread that listens in the queue with the while (my $msg = $q->dequeue) { ... and it will wait until signalled. You can just use this to hold it up or you can check the contents of $msg and behave accordingly

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!
      Understood - awesome, ty!! So I would want my threads->create() calls outside / just before the while loop in #main so they get created, but then inside the loop, based on when it's time to run, I queue them up! (right?) Tiny light bulb flickering on....