Kill forked process on Windows 2000

S

Stéphane Métais

Hello,

I am writing a perl script using fork().
The parent process manages the GUI (with Tk) while the child executes
some work (the 2 processes communicate through a pipe)

But i am facing 3 issues :
1) When terminating, the child causes the following error :
Unable to register TclNotifier window class
Tcl_Panic at my_script line xxx.
This error aborts the whole script.
In order to avoid this, the child doesn't die but tells to the parent
that he has finished and sleeps for ever.
So the parent process must now kill the child process ...

2) ... but when the parent process tries to kill the child process (in
order to abort the work or during the sleep), the child doesn't die.

3) When the parent exits, the script doesn't (perhaps because of the
sleeping child process ?)

So my question : does the "kill" command works properly on Windows 2000
? If yes, how ?

(nb: i use PERL v5.6.1, build 635, ActiveState distribution)

TIA
 
B

Bill

Stéphane Métais said:
Hello,

I am writing a perl script using fork().
The parent process manages the GUI (with Tk) while the child executes
some work (the 2 processes communicate through a pipe)

But i am facing 3 issues :
1) When terminating, the child causes the following error :
Unable to register TclNotifier window class
Tcl_Panic at my_script line xxx.

This should not happen. I'm crossposting this thread to c.l.p.tk for
folks there to advise.
 
B

Bart Lateur

Stéphane Métais said:
So my question : does the "kill" command works properly on Windows 2000
? If yes, how ?

Maybe it does, maybe it doesn't, but AFAIK, fork() is emulated, using
threads. In short: (I think) the parent and the child are actually
threads in the same process. That could be the cause of your problems.

Using Win32::process, you can really launch a separate program for the
child. See this node on Perlmonks for a starting point. Good luck.

<http://perlmonks.org/?node_id=192421>
 
S

sandor

Bart Lateur said:
Maybe it does, maybe it doesn't, but AFAIK, fork() is emulated, using
threads. In short: (I think) the parent and the child are actually
threads in the same process. That could be the cause of your problems.

Using Win32::process, you can really launch a separate program for the
child. See this node on Perlmonks for a starting point. Good luck.

<http://perlmonks.org/?node_id=192421>

.... or use Proc::Background for a really separate process that is portable
to unix and win32
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top