in reply to Nasty MultiThread problem

The solution is to call threads::join on each thread handle before exiting the main thread. This will ensure that all threads have finished before your main thread terminates.

You have this line in your code

#$_->join for @thre;

Why have you commented it out?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Nasty MultiThread problem
by JFarr (Sexton) on Nov 18, 2005 at 22:14 UTC
    I had used that. That did not stop the thread from exiting. I had a 3 second delay from an AnalogGateway, and the thread terminated. Thanks for the reply.
      Then you're probably not joining all active threads, either from not storing hem correctly or for some other reason (I did not look at your code). One way of ensuring that you close all threads:
      $_->join for threads->list();
      According to the pod of "threads"
      threads->list();
                 This will return a list of all non joined, non detached threads.
      
      Hope this helps.
      I had used that. That did not stop the thread from exiting.

      Then you must be calling it at the wrong place in the code.

      It is difficult to try to help further as the code you have posted has at least twothree missing close braces.

      Neither of these if statement bodies are closed.

      if( $serParProcessing eq "P" ) { if( $owsagProcessing eq "P" ) {

      Nor is this subroutine.

      sub locateSysHost_Parallel:locked {


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.