delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/12/23/19:41:29

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <23f801c3c9b6$8c34b080$0600000a@broadpark.no>
From: "Gisle Vanem" <giva AT bgnett DOT no>
To: "Eli Zaretskii" <eliz AT elta DOT co DOT il>
Cc: "djgpp" <djgpp AT delorie DOT com>
References: <207a01c3c8c6$26445c80$0600000a AT broadpark DOT no> <uisk7irn3 DOT fsf AT elta DOT co DOT il> <22ca01c3c974$aa833260$0600000a AT broadpark DOT no> <9003-Tue23Dec2003215638+0200-eliz AT elta DOT co DOT il>
Subject: Re: pending SIGALRM
Date: Wed, 24 Dec 2003 01:40:36 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Reply-To: djgpp AT delorie DOT com

"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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019