Re: Signals to threads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Swapnil Nagle (swapsn@xxxxxxxxxxxxxx) wrote:
> >I have a process "A" spawning thread "B". (using pthreads)
> >
> >ps -aefm | grep "A" gives me two pids, one of "A" and one of "B"
> >
> >When I send a signal to pid-B, it is actually delivered to "A". (I know 
> >this because I have my hook in sys_kill)
> >
> 
> How do you know this in sys_kill() ?
> 
> >Is this always the case ? Can I not send a signal directly to a thread 
> >(not the main thread) ?
> >
> 
> On rh9 kernel (2.4.20-6), sending SIGKILL signal to one of the threads 
> kills both threads. On stock 2.4.27, only the thread to which the signal 
> is sent is killed.
> 
> I don't know why is this behaviour different.
> 

If you want to use signals, process and fork() is much better.

	http://www.serpentine.com/~bos/threads-faq/#10-DCE-POSIX-UI-Why-does-my-threaded-program-not-handle-signals-sensibly-

Hope this can help,

	~Christophe


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux