in reply to Re^7: Scope of thread variable
in thread Scope of thread variable

How do I do that for forked threads?

Replies are listed 'Best First'.
Re^9: Scope of thread variable
by BrowserUk (Patriarch) on Apr 08, 2010 at 17:48 UTC

    Dunno! I don't know how to fork a thread.

      This is what I meant:
      # some code here.... for (0 ..3)) { my $thr = threads->create ( sub { worker(); } )->detach(); } # Master Thread while (1) { master(); }

      How can master() function monitor the threads that were created?

      I am new at threads, sorry for mis-understanding.

        In your loop, you assign the return value from threads->create to a variable. What do you then do with that variable?