emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/syssignal.h


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/syssignal.h
Date: Wed, 15 Dec 2004 18:51:52 -0500

Index: emacs/src/syssignal.h
diff -c emacs/src/syssignal.h:1.38 emacs/src/syssignal.h:1.39
*** emacs/src/syssignal.h:1.38  Sun May  2 16:00:08 2004
--- emacs/src/syssignal.h       Wed Dec 15 21:40:40 2004
***************
*** 20,25 ****
--- 20,30 ----
  
  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
***************
*** 198,202 ****
--- 203,229 ----
  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) */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]