static sigset_t osset;
void block_signals()
{
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset, SIGABRT);
/* sigprocmask(SIG_BLOCK, &sset, &osset); */
pthread_sigmask(SIG_BLOCK, &sset, &osset);
signal(SIGABRT, SIG_DFL);
}
void unblock_signals()
{
sigset_t sset;
sigpending(&sset);
if (sigismember(&sset, SIGABRT))
{
fprintf(stderr, "\njg ==> was interrupted\n");
exit(1);
}
/* sigprocmask(SIG_SETMASK, &osset, NULL); */
pthread_sigmask(SIG_SETMASK, &osset, NULL);
}