Search code examples
clinux

Where does signal handler return back to?


Say that a process is running within the main method when a signal is received and handled. When the signal handler is finished, does the process return back to the line in main where the signal was received, or does it return to the signal call?

P.S. I know I can test this quickly myself but this thought occurred to me while I am without access to my PC.

Thanks.


Solution

  • It returns back to where it was in your code when the signal was triggered.

    Many libraries and applications exploit the same mechanisms to implement threadless multitasking (for instance libmill).