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

Andreas Altergott <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Organization MIRA Consulting GmbH
Message-ID <[email protected]>
Hi,

Andrew Feren wrote:
> Andreas Altergott wrote:
> Did you try the suggested change?

Yes, I did.  It did not work for me.

> I tried very briefly to get Win32::Daemon working, but it didn't want to
> work for me, so I can't speak to Win32::Daemon issues.  That said your
> original service is exiting after 10 seconds because the *parent* not
> the child is calling exit.  The child is returning immediately because
> it has nothing to wait() for.

Hmmm...  Yes, the child ends, but I don't understand why the parent
should terminate.  It is running in an never ending while loop, until it
gets a termination request from the service control manager.  This
should happen when the system goes down, or if a user initiates a
service stop.  Maybe there might be other cases I don't know, but it
should not simply terminate after one loop.

> From the docs you cited (emphasis mine):
> 
>    To the Perl program that called fork(), all this is designed to be
>    transparent. The *parent returns* from the fork() with a
>    *pseudo-process ID* that can be subsequently used in any process
>    manipulation functions; the /*child returns*/ from the fork() with a
>    /*value of |0|*/ to signify that it is the child pseudo-process.
> 
> The service control manager has every right to think the service is
> terminated.  You terminate it when you exit after a 10 second wait.

Yes, it will terminate the parent, if it does not distinguish between
the parent and the child.  It sees a thread terminated, but somehow it
still is alive, so it calls it to terminate.  This seems to be logical,
if it does not distinguish between the parent and it's children.

But if you do use threads instead of fork, then this does not happen.
The same happens using system() or creating children by `` or exec().


Regards,
Andreas
signature.asc (application/pgp-signature, 260 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrTnZoACgkQImDrLy4cAN88RwCgitMCy39Q0ME486FnkufrjGVp
1I8AoN+/S7yNGq3TABdC5oyMJ25lWGnm
=Vndb
-----END PGP SIGNATURE-----
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.