Hello, David

2010/8/24 David Golden <xda...@gmail.com>:
> On Tue, Aug 24, 2010 at 11:41 AM, Alexandr Ciornii <alexcho...@gmail.com> 
> 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

Reply via email to