Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15963
| From | Denys Vlasenko <dvlasenk@redhat.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: "wait" loses signals |
| Date | 2020-02-24 18:19 +0100 |
| Message-ID | <mailman.1505.1582564797.2412.bug-bash@gnu.org> (permalink) |
| References | (4 earlier) <d60f1dbc-990d-7291-e075-b67c07f61a86@case.edu> <00620c20-19ea-e71e-dc1b-926847901f82@redhat.com> <25750.1582534783@jinx.noi.kre.to> <96ce0406-36fd-f93e-6ebc-49bd58b52148@case.edu> <a7e82b8b-046e-dbac-2f10-3f4dcac69f72@redhat.com> |
On 2/24/20 5:18 PM, Chet Ramey wrote:
> The first case is trickier: there's always going to be a window between
> the time the shell checks for pending traps and the time the wait builtin
> starts to run. You can't really close it unless you're willing to run the
> trap out of the signal handler, which everyone agrees is a bad idea, but
> you can squeeze it down to practially nothing.
dash uses something along these lines:
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, &mask);
while (!pending_sig)
sigsuspend(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
if (pending_sig)
handle_signals(pending_sig);
pid = waitpid(... WNOHANG);
It sleeps in sigsuspend(), not in waitpid(). This way we wait for both
signals *and* children (by virtue of getting SIGCHLD for them).
Back to gnu.bash.bug | Previous | Next | Find similar
Re: "wait" loses signals Denys Vlasenko <dvlasenk@redhat.com> - 2020-02-24 18:19 +0100
csiph-web