Razvanica has asked for the wisdom of the Perl Monks concerning the following question:
which creates (or should create) a child to handle with the Guardian subroutine.sub StartErrorGuardian { my ($this, $pm) = @_; $this->Log("INFO","CWAPP: Starting error guardian\n"); $continue_flag = 1; if ($this->{bThreadStarted} == 0) { $this->{bThreadStarted} = 1; my $pid= fork(); if (not defined $pid) { $this->Log("ERROR","CWAPP: Could not start error guardian\ +n"); return 0; } if ($pid == 0) { $this->Guardian(); } else { return $pid; } } return 0; }
If I call the first subroutine from a normal script, everything goes just fine. If I make a fork() and call StartErrorGuardian from the child, nothing happens. And I meen literally nothing. The line my $pid= fork() just blocks the script. It does not pass it. I also tried using Parallel::ForkManager and threads but I get the same result.sub Guardian { my ($this) = @_; my $i = 0; while (1) { {#find any message-box with class #32770 [usually infos and errors +] and press it's child OK button @err_window = FindWindowLike(undef, "", "#32770"); foreach (@err_window) { SetForegroundWindow($_); SetActiveWindow($_); PushChildButton( $err_window[$i], "OK", 0.25 ); PushChildButton( $err_window[$i], "Abort", 0.25 ); } sleep 1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: multithreaded debugging
by andyford (Curate) on Aug 28, 2007 at 20:24 UTC | |
by Razvanica (Novice) on Aug 29, 2007 at 09:05 UTC | |
|
Re: multithreaded debugging
by moritz (Cardinal) on Aug 29, 2007 at 09:23 UTC | |
by Razvanica (Novice) on Aug 29, 2007 at 09:58 UTC | |
|
Re: multithreaded debugging
by BrowserUk (Patriarch) on Aug 29, 2007 at 16:35 UTC |