[OpenAFS-devel] Very simple patch for libafs CPU hog on signal

Nickolai Zeldovich kolya@MIT.EDU
Tue, 29 Jan 2002 11:00:43 -0500


> Actually, your patch _can_ lose signals if they happen _inside_
> the sleep().  For example:
> 
>  save_signals           <-- save an "empty" sigset
>  sleep                  <-- signal comes in here
>  restore_signals        <-- restore the empty sigset, thereby losing
>                             the signal that came in above.

But in my patch, the sigset I'm saving is the blocked sigset, not the
pending sigset.  When the signal is delivered during sleep, the kernel
doesn't wake us up, because the signal is masked out in the blocked
sigset.  When we come out of sleep, we restore the blocked set to what
it was before (probably empty) and recompute the sigpending flag, so
the signal will be delivered on syscall completion.

-- kolya