Use pthread_sigmask, not sigprocmask.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 6 Jul 2011 18:04:23 +0000 (11:04 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 6 Jul 2011 18:04:23 +0000 (11:04 -0700)
* callproc.c (Fcall_process):
* sysdep.c (sys_sigblock, sys_sigunblock, sys_sigsetmask):
* process.c (create_process):
sigprocmask is portable only for single-threaded applications, and
Emacs can be multi-threaded when it uses GTK.

src/ChangeLog
src/callproc.c
src/process.c
src/sysdep.c

index dc62da2..9c73cb9 100644 (file)
@@ -1,3 +1,12 @@
+2011-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use pthread_sigmask, not sigprocmask.
+       * callproc.c (Fcall_process):
+       * sysdep.c (sys_sigblock, sys_sigunblock, sys_sigsetmask):
+       * process.c (create_process):
+       sigprocmask is portable only for single-threaded applications, and
+       Emacs can be multi-threaded when it uses GTK.
+
 2011-07-05  Jan Djärv  <jan.h.d@swipnet.se>
 
        * xsettings.c: Use both GConf and GSettings if both are available.
index b339f34..ad3eddb 100644 (file)
@@ -596,7 +596,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
     sigemptyset (&blocked);
     sigaddset (&blocked, SIGPIPE);
     sigaction (SIGPIPE, 0, &sigpipe_action);
-    sigprocmask (SIG_BLOCK, &blocked, &procmask);
+    pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
 #endif
 
     BLOCK_INPUT;
@@ -633,7 +633,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
           in the child.  */
        //signal (SIGPIPE, SIG_DFL);
 #ifdef HAVE_WORKING_VFORK
-       sigprocmask (SIG_SETMASK, &procmask, 0);
+       pthread_sigmask (SIG_SETMASK, &procmask, 0);
 #endif
 
        child_setup (filefd, fd1, fd_error, (char **) new_argv,
@@ -645,7 +645,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 #ifdef HAVE_WORKING_VFORK
     /* Restore the signal state.  */
     sigaction (SIGPIPE, &sigpipe_action, 0);
-    sigprocmask (SIG_SETMASK, &procmask, 0);
+    pthread_sigmask (SIG_SETMASK, &procmask, 0);
 #endif
 
 #endif /* not WINDOWSNT */
index 6bd168d..1a88435 100644 (file)
@@ -1652,7 +1652,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
   sigaddset (&blocked, SIGHUP );  sigaction (SIGHUP , 0, &sighup_action );
 #endif
 #endif /* HAVE_WORKING_VFORK */
-  sigprocmask (SIG_BLOCK, &blocked, &procmask);
+  pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
 
   FD_SET (inchannel, &input_wait_mask);
   FD_SET (inchannel, &non_keyboard_wait_mask);
@@ -1808,7 +1808,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
        signal (SIGPIPE, SIG_DFL);
 
        /* Stop blocking signals in the child.  */
-       sigprocmask (SIG_SETMASK, &procmask, 0);
+       pthread_sigmask (SIG_SETMASK, &procmask, 0);
 
        if (pty_flag)
          child_setup_tty (xforkout);
@@ -1900,7 +1900,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
 #endif
 #endif /* HAVE_WORKING_VFORK */
   /* Stop blocking signals in the parent.  */
-  sigprocmask (SIG_SETMASK, &procmask, 0);
+  pthread_sigmask (SIG_SETMASK, &procmask, 0);
 
   /* Now generate the error if vfork failed.  */
   if (pid < 0)
index 8b6939b..46667cf 100644 (file)
@@ -1534,7 +1534,7 @@ sigset_t
 sys_sigblock (sigset_t new_mask)
 {
   sigset_t old_mask;
-  sigprocmask (SIG_BLOCK, &new_mask, &old_mask);
+  pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
   return (old_mask);
 }
 
@@ -1542,7 +1542,7 @@ sigset_t
 sys_sigunblock (sigset_t new_mask)
 {
   sigset_t old_mask;
-  sigprocmask (SIG_UNBLOCK, &new_mask, &old_mask);
+  pthread_sigmask (SIG_UNBLOCK, &new_mask, &old_mask);
   return (old_mask);
 }
 
@@ -1550,7 +1550,7 @@ sigset_t
 sys_sigsetmask (sigset_t new_mask)
 {
   sigset_t old_mask;
-  sigprocmask (SIG_SETMASK, &new_mask, &old_mask);
+  pthread_sigmask (SIG_SETMASK, &new_mask, &old_mask);
   return (old_mask);
 }