emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/keyboard.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/keyboard.c
Date: Tue, 07 Dec 2004 03:56:50 -0500

Index: emacs/src/keyboard.c
diff -c emacs/src/keyboard.c:1.798 emacs/src/keyboard.c:1.799
*** emacs/src/keyboard.c:1.798  Tue Nov 30 05:57:27 2004
--- emacs/src/keyboard.c        Tue Dec  7 08:25:43 2004
***************
*** 45,50 ****
--- 45,53 ----
  #include <setjmp.h>
  #include <errno.h>
  
+ #ifdef HAVE_GTK_AND_PTHREAD
+ #include <pthread.h>
+ #endif
  #ifdef MSDOS
  #include "msdos.h"
  #include <time.h>
***************
*** 6777,6782 ****
--- 6780,6804 ----
  #ifdef BSD4_1
    extern int select_alarmed;
  #endif
+ #ifdef HAVE_GTK_AND_PTHREAD
+   extern pthread_t main_thread;
+   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.  */
+ #ifdef SIGIO
+       sigset_t new_mask;
+ 
+       sigemptyset (&new_mask);
+       sigaddset (&new_mask, SIGIO);
+       pthread_sigmask (SIG_BLOCK, &new_mask, 0);
+       pthread_kill (main_thread, SIGIO);
+ #endif
+       return;
+     }
+ #endif
+ 
    interrupt_input_pending = 0;
  
    while (1)
***************
*** 6804,6810 ****
  {
    /* Must preserve main program's value of errno.  */
    int old_errno = errno;
! 
  #if defined (USG) && !defined (POSIX_SIGNALS)
    /* USG systems forget handlers when they are used;
       must reestablish each time */
--- 6826,6847 ----
  {
    /* Must preserve main program's value of errno.  */
    int old_errno = errno;
! #ifdef HAVE_GTK_AND_PTHREAD
!   extern pthread_t main_thread;
!   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, SIGIO);
!       pthread_sigmask (SIG_BLOCK, &new_mask, 0);
!       pthread_kill (main_thread, SIGIO);
!       return;
!     }
! #endif /* HAVE_GTK_AND_PTHREAD */
  #if defined (USG) && !defined (POSIX_SIGNALS)
    /* USG systems forget handlers when they are used;
       must reestablish each time */




reply via email to

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