summaryrefslogtreecommitdiff
path: root/src/syssignal.h
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2004-12-23 16:43:51 +0000
committerKaroly Lorentey <lorentey@elte.hu>2004-12-23 16:43:51 +0000
commit17d51b68fb4e7da4f18eff72c589b7ffc4f9c22c (patch)
treef490c1ccdbd43077ea77f953bc59ca94c2fe810c /src/syssignal.h
parent4b89585ee70a1f64543a5851f07cf7e2d89c5c62 (diff)
parent55f4edbcd246d8ea1715687a7aeeb3afe35c0345 (diff)
downloademacs-17d51b68fb4e7da4f18eff72c589b7ffc4f9c22c.tar.gz
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-726 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-727 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-728 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-729 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-730 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-731 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-732 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-733 Update from CVS: man/calc.texi: Fix some TeX definitions. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-734 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-735 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-736 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-737 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-738 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-739 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-740 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-741 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-742 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-743 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-744 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-745 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-746 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-75 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-76 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-77 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-277
Diffstat (limited to 'src/syssignal.h')
-rw-r--r--src/syssignal.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/syssignal.h b/src/syssignal.h
index 8d58325c02c..ab61d111398 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -20,6 +20,11 @@ Boston, MA 02111-1307, USA. */
extern void init_signals P_ ((void));
+#ifdef HAVE_GTK_AND_PTHREAD
+#include <pthread.h>
+extern pthread_t main_thread;
+#endif
+
#ifdef POSIX_SIGNALS
/* Don't #include <signal.h>. That header should always be #included
@@ -199,5 +204,27 @@ extern SIGMASKTYPE sigprocmask_set;
char *strsignal ();
#endif
+#ifdef HAVE_GTK_AND_PTHREAD
+#define SIGNAL_THREAD_CHECK(signo) \
+ do { \
+ if (pthread_self () != main_thread) \
+ { \
+ /* POSIX says any thread can receive the signal. On GNU/Linux \
+ that is not true, but for other systems (FreeBSD at least) \
+ it is. So direct the signal to the correct thread and block \
+ it from this thread. */ \
+ sigset_t new_mask; \
+ \
+ sigemptyset (&new_mask); \
+ sigaddset (&new_mask, signo); \
+ pthread_sigmask (SIG_BLOCK, &new_mask, 0); \
+ pthread_kill (main_thread, signo); \
+ return; \
+ } \
+ } while (0)
+
+#else /* not HAVE_GTK_AND_PTHREAD */
+#define SIGNAL_THREAD_CHECK(signo)
+#endif /* not HAVE_GTK_AND_PTHREAD */
/* arch-tag: 4580e86a-340d-4574-9e11-a742b6e1a152
(do not change this comment) */