summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/emacs.c b/src/emacs.c
index fb7c573836a..b16ea78b9b8 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -343,6 +343,14 @@ int fatal_error_in_progress;
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
@@ -351,6 +359,7 @@ handle_USR1_signal (sig)
{
struct input_event buf;
+ SIGNAL_THREAD_CHECK (sig);
bzero (&buf, sizeof buf);
buf.kind = USER_SIGNAL_EVENT;
buf.frame_or_window = selected_frame;
@@ -366,6 +375,7 @@ handle_USR2_signal (sig)
{
struct input_event buf;
+ SIGNAL_THREAD_CHECK (sig);
bzero (&buf, sizeof buf);
buf.kind = USER_SIGNAL_EVENT;
buf.code = 1;
@@ -380,6 +390,7 @@ SIGTYPE
fatal_error_signal (sig)
int sig;
{
+ SIGNAL_THREAD_CHECK (sig);
fatal_error_code = sig;
signal (sig, SIG_DFL);
@@ -419,6 +430,7 @@ memory_warning_signal (sig)
int sig;
{
signal (sig, memory_warning_signal);
+ SIGNAL_THREAD_CHECK (sig);
malloc_warning ("Operating system warns that virtual memory is running low.\n");
@@ -1024,10 +1036,16 @@ main (argc, argv
Also call realloc and free for consistency. */
free (realloc (malloc (4), 4));
+# ifndef SYNC_INPUT
/* Arrange to disable interrupt input inside malloc etc. */
uninterrupt_malloc ();
+# 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. */
@@ -1116,7 +1134,10 @@ main (argc, argv
/* Handle the -batch switch, which means don't do interactive display. */
noninteractive = 0;
if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args))
- noninteractive = 1;
+ {
+ noninteractive = 1;
+ Vundo_outer_limit = Qnil;
+ }
if (argmatch (argv, argc, "-script", "--script", 3, &junk, &skip_args))
{
noninteractive = 1; /* Set batch mode. */
@@ -2237,7 +2258,7 @@ You must run Emacs in batch mode in order to dump it. */)
memory_warnings (my_edata, malloc_warning);
#endif /* not WINDOWSNT */
#endif
-#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD)
+#if !defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
/* Pthread may call malloc before main, and then we will get an endless
loop, because pthread_self (see alloc.c) calls malloc the first time
it is called on some systems. */