Re: POE::Wheel::Run::Win32 and Win32::Daemon

Rocco Caputo <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
The question in my mind: If fork() is so troublesome on Windows, do we  
have an alternative?

For the (Program => "foo.exe") form, we can possibly avoid fork()  
altogether.  http://rt.cpan.org/Public/Bug/Display.html?id=48715#txn-659406 
  includes some code that promises to work well.

For the (Program => \&foo) case, I don't know.  Can Perl on Windows  
handle that well at all?

-- 
Rocco Caputo - [email protected]


On Oct 12, 2009, at 10:54, Andreas Altergott wrote:

> Hi,
>
> Andrew Feren wrote:
>> Something like the following will give you better results.
>>
>>       my $pid;
>>       if($pid = fork()) {
>>         print(FOUT "running ($pid)\n");
>>         wait();
>>       } else {
>>         open(FOR, '>>', 'C:\delme-kid.txt');
>>         thread();
>>         close(FOR);
>>         sleep(10);
>>         exit(0);
>>       }
>
> Thanks for the suggestion, but I do not see why this should give  
> better
> results in combination with Win32::Daemon.  As already described the
> service will get a termination request as soon as the child  
> terminates,
> if you do use fork.  Nevertheless I tested this and it did terminate  
> the
> service after one loop.
>
> The termination request comes from the service control manager.
> Probably it thinks the service terminated.  This doesn't make sense.
> Especially because it tries to tell a service to stop, which in its
> opinion did already stop.  Nevertheless it does so.
>
> This behaviour happens only with fork AFAIK.
>
>
> Regards,
> Andreas
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.