about summary refs log tree commit diff
path: root/signal
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2017-11-01 11:56:53 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2017-11-06 17:37:57 -0200
commitd83da3a4cebcf77e34593b86112dfad332808dae (patch)
tree625e7c99cd0b38a0c685bc3d7b23631dcbe8db85 /signal
parent6a4235f129b75ad9963ae93d9f386b8b366cb65a (diff)
downloadglibc-d83da3a4cebcf77e34593b86112dfad332808dae.tar.gz
glibc-d83da3a4cebcf77e34593b86112dfad332808dae.tar.xz
glibc-d83da3a4cebcf77e34593b86112dfad332808dae.zip
Optimize sighold implementation
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>
Diffstat (limited to 'signal')
-rw-r--r--signal/sighold.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/signal/sighold.c b/signal/sighold.c
index 2e32e4718a..955ac5b0fb 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);
 }