Signal handlers
Yousef Alhashemi
yousef.alhashemi at gmail.com
Sun Mar 31 13:58:33 EDT 2013
On Sun, Mar 31, 2013 at 8:33 PM, Rahul Gandhi <rahul.rahulgags at gmail.com>wrote:
As per my understanding, when the signal denoted by signum occurs/is
> raised, the action is taken which can be either SIG_DFL, SIG_IGN or a
> function/handler. What i don't understand is, when we write for example signal(SIGPROF,
> handler); isn't this supposed to be asynchronous? however the code is
> executed sequentially. So, when this function is encountered, it is
> executed and when a signal is raised, how does it know what to do?
>
signal() in your example lets the operating system know that you want the
function 'handler' to be executed if SIGPROF is raised and delivered to
your process; it doesn't call the handler when that line of code is
executed.
~Yousef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130331/4408f0e8/attachment.html
More information about the Kernelnewbies
mailing list