summaryrefslogtreecommitdiff
path: root/src/signal/sigsetjmp.c
blob: cb2257f0c45f8918c9e409052d8b3e322bd5a67a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <setjmp.h>
#include <signal.h>

/* !!! This function will not work unless the compiler performs
 * tail call optimization. Machine-specific asm versions should
 * be created instead even though the workaround (tail call)
 * is entirely non-machine-specific... */

int sigsetjmp(sigjmp_buf buf, int save)
{
	if ((buf->__fl = save))
		pthread_sigmask(SIG_SETMASK, 0, (sigset_t *)buf->__ss);
	return setjmp(buf);
}