Linux waitpid/__WALL emulation wrapper: If WNOHANG is set, don't touch sigprocmask.
Just a small optimization. No need to block/unblock signals if we're not going to call sigsuspend. gdb/ 2014-02-27 Pedro Alves <palves@redhat.com> * nat/linux-waitpid.c (my_waitpid): Only block signals if WNOHANG isn't set.
This commit is contained in:
parent
1db37fe627
commit
2fa0369e51
@ -1,3 +1,8 @@
|
||||
2014-02-27 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* nat/linux-waitpid.c (my_waitpid): Only block signals if WNOHANG
|
||||
isn't set.
|
||||
|
||||
2014-02-27 Pedro Alves <palves@redhat.com>
|
||||
|
||||
PR 12702
|
||||
|
@ -92,15 +92,19 @@ my_waitpid (int pid, int *status, int flags)
|
||||
|
||||
wnohang = (flags & WNOHANG) != 0;
|
||||
flags &= ~(__WALL | __WCLONE);
|
||||
flags |= WNOHANG;
|
||||
|
||||
/* Block all signals while here. This avoids knowing about
|
||||
LinuxThread's signals. */
|
||||
sigfillset (&block_mask);
|
||||
sigprocmask (SIG_BLOCK, &block_mask, &org_mask);
|
||||
if (!wnohang)
|
||||
{
|
||||
flags |= WNOHANG;
|
||||
|
||||
/* ... except during the sigsuspend below. */
|
||||
sigemptyset (&wake_mask);
|
||||
/* Block all signals while here. This avoids knowing about
|
||||
LinuxThread's signals. */
|
||||
sigfillset (&block_mask);
|
||||
sigprocmask (SIG_BLOCK, &block_mask, &org_mask);
|
||||
|
||||
/* ... except during the sigsuspend below. */
|
||||
sigemptyset (&wake_mask);
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -129,7 +133,8 @@ my_waitpid (int pid, int *status, int flags)
|
||||
flags ^= __WCLONE;
|
||||
}
|
||||
|
||||
sigprocmask (SIG_SETMASK, &org_mask, NULL);
|
||||
if (!wnohang)
|
||||
sigprocmask (SIG_SETMASK, &org_mask, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user