diff mbox series

[v2,6/8] Optimize sighold implementation

Message ID 1509975426-1772-6-git-send-email-adhemerval.zanella@linaro.org
State New
Headers show
Series [v2,1/8] Rename nptl-signals.h to internal-signals.h | expand

Commit Message

Adhemerval Zanella Nov. 6, 2017, 1:37 p.m. UTC
This patch simplifies sighold a bit by removing an extra sigprocmask
and using SIG_BLOCK (which union of the current set and the set argument).

Checked on x86_64-linux-gnu.

	* signal/sighold.c (sighold): Optimize implementation.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

Reviewed-by: Zack Weinberg <zackw@panix.com>

---
 ChangeLog        |  2 ++
 signal/sighold.c | 10 ++--------
 2 files changed, 4 insertions(+), 8 deletions(-)

-- 
2.7.4
diff mbox series

Patch

diff --git a/signal/sighold.c b/signal/sighold.c
index 2e32e47..955ac5b 100644
--- a/signal/sighold.c
+++ b/signal/sighold.c
@@ -26,14 +26,8 @@  sighold (int sig)
 {
   sigset_t set;
 
-  /* Retrieve current signal set.  */
-  if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
-    return -1;
-
-  /* Add the specified signal.  */
+  sigemptyset (&set);
   if (sigaddset (&set, sig) < 0)
     return -1;
-
-  /* Set the new mask.  */
-  return __sigprocmask (SIG_SETMASK, &set, NULL);
+  return __sigprocmask (SIG_BLOCK, &set, NULL);
 }