in reply to Re: Restart Forked Script
in thread Restart Forked Script

How do I determine the PID of the master process ? Also I forget to mention that I am running ActiveState Perl on Win32. I hope this doesn't matter. :)

Replies are listed 'Best First'.
Re^3: Restart Forked Script
by salva (Canon) on Feb 21, 2006 at 13:21 UTC
    Also I forget to mention that I am running ActiveState Perl on Win32. I hope this doesn't matter

    Unfortunately it does!

    Windows does not support fork at the OS level, perl tries to emulate it creating a new threat and cloning your program state but it is far from perfect.

    On Windows it is better to use threads to run several tasks in parallel rather than fork.

      What I didn't publish is the following in my code: just after:
      $kid = fork;
      I am doing the following:
      $dbh = DBI->connect("DBI:mysql:DatabaseName;host=127.0.0.1;mysql_serve +r_prepare=1",'root','pass',{AutoCommit=>1}) or die $DBI::errstr;
      It works just fine for me using the fork emulation. Can you perhaps may be give me an example of using multiple Database handles and threading server with IO::Socket. Thanks a lot for your answers, you are really helping me.
        why don't you tell us briedfly what your applications does?

        Killing a process that could be writting data to a database is not the finest idea.