The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: shibu-kundara <thomasece@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Signals and threads
Date: Fri, 24 Nov 2006 19:05:44 -0600	[thread overview]
Message-ID: <456796E8.6010409@shaw.ca> (raw)
In-Reply-To: <1164362486.344548.309830@45g2000cws.googlegroups.com>

shibu-kundara wrote:
>     Hi
> 
> I have a problem using sigaction function in pthread library.
> I have 2 thread each one registering
> 
> in threadA
>  act1.sa_handler=func1;
>  if(sigaction(SIGUSR1,&act1,NULL)) printf("\nSigaction failed! in th1
> !!\n");
> 
> in threadB
>  act1.sa_handler=func2;
>  if(sigaction(SIGUSR1,&act2,NULL)) printf("\nSigaction failed! in th2
> !!\n");
> 
> but when i send signal SIGUSR1 to threadA , threadA  receives the
> signal
> but the handler func2 is getting called,
> 
> 
> Please let me know is there any way to solve this problem?
> thanks in advance
> thomas
> 

Signal handlers are global to the process. You can't create different 
handlers for the same signal in multiple threads.

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/


           reply	other threads:[~2006-11-25  1:05 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1164362486.344548.309830@45g2000cws.googlegroups.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=456796E8.6010409@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomasece@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox