Main Page | Report this Page
Linux Forum Index  »  Linux Development - Applications  »  Signal from outside the process to a thread ....
Page 1 of 1    

Signal from outside the process to a thread ....

Author Message
krishna...
Posted: Tue Oct 06, 2009 10:51 pm
Guest
Hi Friends,
I have one basic question which I couldn't successfuly google.
Hence please provide me some pointers for this question. Please
correct me if my understanding itslef is wrong.

When a multi threaded process receives a signal from outside, its
the main thread which will receive that signal. Lets say apart from
main thread, there is one of the thread by the name "pth1". Should
main thread be taking any explicit action to pass on this signal to
"pth1" ? If so how is it done in case of signals which can't be
caught?

Thanks & Regards,
Kaushal.
 
Rainer Weikusat...
Posted: Wed Oct 07, 2009 5:33 am
Guest
krishna <kaushal.r at (no spam) gmail.com> writes:

[...]

Quote:
When a multi threaded process receives a signal from outside, its
the main thread which will receive that signal.

There is no such thing as a 'main thread'. A process initially starts
with just one thread and for historical reasons, the memory layout of
the stack used by it is different from the memory layout of stacks
used by threads created later.

Regarding signals: There are two types of signals, asychronous and
synchronous signals. An asynchronous signal is one which has been
caused by an external event which has no direct relation to the
current actions of any particular thread. Examples would be SIGINT
caused by a user who pressed 'the interrupt key' (usually, Ctrl-C),
sending a signal to a process by using the kill-command or the expiry
of a timer. In a POSIX threading environment, signal handlers are a
per-process ressource and an asychronous signal supposed to be handled
will cause the handler to be executed by an arbitrary thread not
currently blocking the signal. A synchronous signal is one caused as a
direct response to action of some thread. Examples would be SIGSEGV
or SIGFPE. Such signals are delivered to the thread which caused them
to happen, although the default action (eg 'terminate process with
coredump' may apply to the process as a whole).
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Mon Nov 30, 2009 3:02 am