Commit 123403e4 authored by Paul Eggert's avatar Paul Eggert

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.
parent 6db30f83
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> 2011-07-05 Jan Djärv <jan.h.d@swipnet.se>
* xsettings.c: Use both GConf and GSettings if both are available. * xsettings.c: Use both GConf and GSettings if both are available.
......
...@@ -596,7 +596,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -596,7 +596,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
sigemptyset (&blocked); sigemptyset (&blocked);
sigaddset (&blocked, SIGPIPE); sigaddset (&blocked, SIGPIPE);
sigaction (SIGPIPE, 0, &sigpipe_action); sigaction (SIGPIPE, 0, &sigpipe_action);
sigprocmask (SIG_BLOCK, &blocked, &procmask); pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
#endif #endif
BLOCK_INPUT; BLOCK_INPUT;
...@@ -633,7 +633,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -633,7 +633,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
in the child. */ in the child. */
//signal (SIGPIPE, SIG_DFL); //signal (SIGPIPE, SIG_DFL);
#ifdef HAVE_WORKING_VFORK #ifdef HAVE_WORKING_VFORK
sigprocmask (SIG_SETMASK, &procmask, 0); pthread_sigmask (SIG_SETMASK, &procmask, 0);
#endif #endif
child_setup (filefd, fd1, fd_error, (char **) new_argv, child_setup (filefd, fd1, fd_error, (char **) new_argv,
...@@ -645,7 +645,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -645,7 +645,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
#ifdef HAVE_WORKING_VFORK #ifdef HAVE_WORKING_VFORK
/* Restore the signal state. */ /* Restore the signal state. */
sigaction (SIGPIPE, &sigpipe_action, 0); sigaction (SIGPIPE, &sigpipe_action, 0);
sigprocmask (SIG_SETMASK, &procmask, 0); pthread_sigmask (SIG_SETMASK, &procmask, 0);
#endif #endif
#endif /* not WINDOWSNT */ #endif /* not WINDOWSNT */
......
...@@ -1652,7 +1652,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) ...@@ -1652,7 +1652,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action ); sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
#endif #endif
#endif /* HAVE_WORKING_VFORK */ #endif /* HAVE_WORKING_VFORK */
sigprocmask (SIG_BLOCK, &blocked, &procmask); pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
FD_SET (inchannel, &input_wait_mask); FD_SET (inchannel, &input_wait_mask);
FD_SET (inchannel, &non_keyboard_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) ...@@ -1808,7 +1808,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
signal (SIGPIPE, SIG_DFL); signal (SIGPIPE, SIG_DFL);
/* Stop blocking signals in the child. */ /* Stop blocking signals in the child. */
sigprocmask (SIG_SETMASK, &procmask, 0); pthread_sigmask (SIG_SETMASK, &procmask, 0);
if (pty_flag) if (pty_flag)
child_setup_tty (xforkout); child_setup_tty (xforkout);
...@@ -1900,7 +1900,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) ...@@ -1900,7 +1900,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
#endif #endif
#endif /* HAVE_WORKING_VFORK */ #endif /* HAVE_WORKING_VFORK */
/* Stop blocking signals in the parent. */ /* Stop blocking signals in the parent. */
sigprocmask (SIG_SETMASK, &procmask, 0); pthread_sigmask (SIG_SETMASK, &procmask, 0);
/* Now generate the error if vfork failed. */ /* Now generate the error if vfork failed. */
if (pid < 0) if (pid < 0)
......
...@@ -1534,7 +1534,7 @@ sigset_t ...@@ -1534,7 +1534,7 @@ sigset_t
sys_sigblock (sigset_t new_mask) sys_sigblock (sigset_t new_mask)
{ {
sigset_t old_mask; sigset_t old_mask;
sigprocmask (SIG_BLOCK, &new_mask, &old_mask); pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
return (old_mask); return (old_mask);
} }
...@@ -1542,7 +1542,7 @@ sigset_t ...@@ -1542,7 +1542,7 @@ sigset_t
sys_sigunblock (sigset_t new_mask) sys_sigunblock (sigset_t new_mask)
{ {
sigset_t old_mask; sigset_t old_mask;
sigprocmask (SIG_UNBLOCK, &new_mask, &old_mask); pthread_sigmask (SIG_UNBLOCK, &new_mask, &old_mask);
return (old_mask); return (old_mask);
} }
...@@ -1550,7 +1550,7 @@ sigset_t ...@@ -1550,7 +1550,7 @@ sigset_t
sys_sigsetmask (sigset_t new_mask) sys_sigsetmask (sigset_t new_mask)
{ {
sigset_t old_mask; sigset_t old_mask;
sigprocmask (SIG_SETMASK, &new_mask, &old_mask); pthread_sigmask (SIG_SETMASK, &new_mask, &old_mask);
return (old_mask); return (old_mask);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment