Mail Archives: djgpp-workers/2001/01/22/13:02:48
> > When the delays test is run (the one with the failing SIGALRM),
> > it hooks SIGALRM to this:
> >
> > RETSIGTYPE
> > timeoutHandler(sig)
> > int sig;
> > {
> > setSignalHandler(sig, SIG_DFL);
> > asyncSignal(timeoutSem);
> > timeoutSem = nilOOP;
> > }
> Is it possible that SIGALRM happens more than once? If so, the second
> time will abort the program, because the above handler resets the
> SIGALRM handler to SIG_DFL.
Yes, but the function that sets the alarm in the first place, first sets
the signal handler to the function it's passed (i.e. timeoutHandler).
So I don't see how they could overlap.
> What do disableInterrupts() and enableInterrupts() do? What
> ``interrupts'' do they disable/enable?
IntState
disableInterrupts()
{
sigset_t newSet;
static sigset_t oldSet;
if (disabled) {
/* let only the outermost calls actually block and unblock signals */
return ((IntState) NULL);
}
disabled = true;
sigfillset(&newSet);
sigprocmask(SIG_BLOCK, &newSet, &oldSet);
return ((IntState) &oldSet);
}
void
enableInterrupts(newSet)
IntState newSet;
{
if (newSet) {
disabled = false;
sigprocmask(SIG_SETMASK, (sigset_t *) newSet, NULL);
}
}
are the ones used for DJGPP (since we have SIG_BLOCK).
> In general, I doubt if this is the problem, since this code runs
> _after_ SIGALRM already happened, and it runs from the SIGALRM
> handler. By contrast, the traceback you showed indicates that the
> default (i.e. SIG_DFL) handler was called.
Yep. Sure looks that way...
What I expect happens is that the __dpmi_yield() takes so 'long' that
a second alarm gets set (if two alarms are set, do they BOTH fire?)
before the first one is done; then the signal handler will be set to
SIG_DFLT by the time the second alarm fires (even though it had set
the hook to timeoutHandler).
- Raw text -