setcontext in a signal handler
Will Newton
will.newton@linaro.org
Tue Mar 4 02:46:00 GMT 2014
Hi Michael,
The current getcontext(3) manpage has the following wording:
"Do not leave the handler using longjmp(3): it is undefined what
would happen with contexts. Use siglongjmp(3) or setcontext()
instead."
However the glibc documentation[1] has this:
" It is not allowed to do the context switching from the signal
handler directly since neither setcontext nor swapcontext are
functions which can be called from a signal handler."
It's not clear to me that there is any standard that mandates that
setcontext cannot be called from a signal handler or whether it is an
implementation detail of glibc. Does anybody know of any historical
reasons for this being the case?
Thanks,
[1] http://www.gnu.org/software/libc/manual/html_node/System-V-contexts.html
--
Will Newton
Toolchain Working Group, Linaro
More information about the Libc-alpha
mailing list