01ba0dffeddf4f7502c4db31fc251f1bdb00226a
[musl] / src / signal / sigsetjmp.c
1 #include <setjmp.h>
2 #include <signal.h>
3 #include <stdlib.h>
4
5 /* !!! This function will not work unless the compiler performs
6  * tail call optimization. Machine-specific asm versions should
7  * be created instead even though the workaround (tail call)
8  * is entirely non-machine-specific... */
9
10 int sigsetjmp(sigjmp_buf buf, int save)
11 {
12         if ((buf->__fl = save))
13                 pthread_sigmask(SIG_SETMASK, 0, (sigset_t *)buf->__ss);
14         return setjmp(buf->__jb);
15 }