Mercurial > emacs
diff src/emacs.c @ 58986:59945307b86b
* syssignal.h: Declare main_thread.
(SIGNAL_THREAD_CHECK): New macro.
* keyboard.c (input_available_signal): Move thread checking code
to macro SIGNAL_THREAD_CHECK and call that macro.
(interrupt_signal): Call SIGNAL_THREAD_CHECK.
* alloc.c (uninterrupt_malloc): Move main_thread to emacs.c.
* emacs.c: Define main_thread.
(main): Initialize main_thread.
(handle_USR1_signal, handle_USR2_signal, fatal_error_signal)
(memory_warning_signal): Call SIGNAL_THREAD_CHECK.
* floatfns.c (float_error): Call SIGNAL_THREAD_CHECK.
* dispnew.c (window_change_signal): Call SIGNAL_THREAD_CHECK.
* sysdep.c (select_alarm): Call SIGNAL_THREAD_CHECK.
* process.c (send_process_trap, sigchld_handler): Call
SIGNAL_THREAD_CHECK.
* data.c (arith_error): Call SIGNAL_THREAD_CHECK.
* atimer.c (alarm_signal_handler): Call SIGNAL_THREAD_CHECK.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Wed, 15 Dec 2004 21:40:41 +0000 |
parents | 4406d551c5c6 |
children | 51027cf26edc |
line wrap: on
line diff
--- a/src/emacs.c Wed Dec 15 21:34:14 2004 +0000 +++ b/src/emacs.c Wed Dec 15 21:40:41 2004 +0000 @@ -342,6 +342,14 @@ void (*fatal_error_signal_hook) P_ ((void)); +#ifdef HAVE_GTK_AND_PTHREAD +/* When compiled with GTK and running under Gnome, multiple threads meay be + created. Keep track of our main thread to make sure signals are delivered + to it (see syssignal.h). */ + +pthread_t main_thread; +#endif + #ifdef SIGUSR1 SIGTYPE @@ -350,6 +358,7 @@ { struct input_event buf; + SIGNAL_THREAD_CHECK (sig); bzero (&buf, sizeof buf); buf.kind = USER_SIGNAL_EVENT; buf.frame_or_window = selected_frame; @@ -365,6 +374,7 @@ { struct input_event buf; + SIGNAL_THREAD_CHECK (sig); bzero (&buf, sizeof buf); buf.kind = USER_SIGNAL_EVENT; buf.code = 1; @@ -379,6 +389,7 @@ fatal_error_signal (sig) int sig; { + SIGNAL_THREAD_CHECK (sig); fatal_error_code = sig; signal (sig, SIG_DFL); @@ -418,6 +429,7 @@ int sig; { signal (sig, memory_warning_signal); + SIGNAL_THREAD_CHECK (sig); malloc_warning ("Operating system warns that virtual memory is running low.\n"); @@ -1029,6 +1041,10 @@ # endif /* not SYNC_INPUT */ #endif /* not SYSTEM_MALLOC */ +#ifdef HAVE_GTK_AND_PTHREAD + main_thread = pthread_self (); +#endif /* HAVE_GTK_AND_PTHREAD */ + #if defined (MSDOS) || defined (WINDOWSNT) /* We do all file input/output as binary files. When we need to translate newlines, we do that manually. */