Re: fork emulation / kill

[email protected] (Alexandr Ciornii)
Newsgroups perl.win32.vanilla
Message-ID <[email protected]>
Hello, David

2010/8/24 David Golden <[email protected]>:
> On Tue, Aug 24, 2010 at 11:41 AM, Alexandr Ciornii <[email protected]> wrote:
>> Is it possible to kill a thread that was created by fork()? signal to
>> pid of thread results in termination of whole program
>>
>> kill( 2, $pid ); #$pid - pid of forked thread
>> Whole program dies with:
>> Terminating on signal SIGINT(2)
>
> I think that might be special treatment of SIGINT.  Have you tried it
> with SIGTERM?
Same problem:
Terminating on signal SIGTERM(15)

> If I remember correctly, Control-C is emulated on Win32 in a way that
> passes the signal to the console, which passes it to all processes on
> the console.  (This is exactly what happens if you hit Control-C on
> the keyboard.)  If your parent ignores SIGINT, then you should be able
> to kill the child with it.
Both
    $SIG{'INT'} = 'IGNORE';
    kill( 2, $pid );
and
    $SIG{'TERM'} = 'IGNORE';
    kill( 15, $pid );
result in termination of main program.



-- 
Alexandr Ciornii, http://chorny.net
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.