Mail Archives: djgpp/2003/12/23/19:41:29
"Eli Zaretskii" <eliz AT elta DOT co DOT il> said:
> Anyway, I'm not sure I understand what is your question, beyond the
> ones you asked in the original message. Is the code you've shown
> failing in some way? If so, what isn't working there, and how it
> fails, exactly?
I've changed my signal code so many times but I think it's working now.
> Btw, one comment about your code:
>
> > void sock_sig_restore (int sig)
> > {
> > sigset_t pending;
> > if (sigpending(&pending) == 0 &&
> > sigismember(&pending,SIGALRM) == 1) &&
> > sigprocmask(SIG_UNBLOCK, &new_mask, &old_mask))
> > ; /* calls the alarm() handler now when it's safe */
>
> There's no need to call the alarm() handler after unmasking SIGALRM,
I know. Note the original ";" and the "else" part:
sigprocmask(SIG_UNBLOCK, &new_mask, &old_mask))
; /* calls the alarm() handler now when it's safe */
else if (sig)
What I mean was "sigprocmask() calls the alarm() handler ...".
PS. I tried the sigprocmask() approach and it's more compact. But since
I've no place to longjmp() from, that means I must sprinkle all my loops
with tests for pending signals.
--gv
- Raw text -