emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113278: Try again to fix FreeBSD bug re multithread


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113278: Try again to fix FreeBSD bug re multithreaded memory alloc.
Date: Thu, 04 Jul 2013 06:20:59 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113278
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/14569
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2013-07-03 23:20:55 -0700
message:
  Try again to fix FreeBSD bug re multithreaded memory alloc.
  
  * emacs.c (main) [HAVE_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]:
  Do not clear _malloc_thread_enabled_p, undoing the previous change,
  which did not work (see <http://bugs.gnu.org/14569#307>).
  (main): Do not invoke malloc_enable_thread if (! CANNOT_DUMP
  && (!noninteractive || initialized)).  This attempts to thread
  the needle between the Scylla of FreeBSD and the Charybdis of Cygwin.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/emacs.c                    emacs.c-20091113204419-o5vbwnq5f7feedwu-241
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-07-04 02:08:56 +0000
+++ b/src/ChangeLog     2013-07-04 06:20:55 +0000
@@ -1,3 +1,13 @@
+2013-07-04  Paul Eggert  <address@hidden>
+
+       Try again to fix FreeBSD bug re multithreaded memory alloc (Bug#14569).
+       * emacs.c (main) [HAVE_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]:
+       Do not clear _malloc_thread_enabled_p, undoing the previous change,
+       which did not work (see <http://bugs.gnu.org/14569#307>).
+       (main): Do not invoke malloc_enable_thread if (! CANNOT_DUMP
+       && (!noninteractive || initialized)).  This attempts to thread
+       the needle between the Scylla of FreeBSD and the Charybdis of Cygwin.
+
 2013-07-04  Juanma Barranquero  <address@hidden>
 
        * image.c (x_to_xcolors) [HAVE_NTGUI]: Remove unused var `hdc'.

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2013-07-04 00:53:13 +0000
+++ b/src/emacs.c       2013-07-04 06:20:55 +0000
@@ -128,7 +128,6 @@
    dumping.  Used to work around a bug in glibc's malloc.  */
 static bool malloc_using_checking;
 #elif defined HAVE_PTHREAD && !defined SYSTEM_MALLOC
-extern int _malloc_thread_enabled_p;
 extern void malloc_enable_thread (void);
 #endif
 
@@ -682,12 +681,6 @@
   stack_base = &dummy;
 #endif
 
-#if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC
-  /* Disable mutexes in gmalloc.c.  Otherwise, FreeBSD Emacs recursively
-     loops with pthread_mutex_lock calling calloc and vice versa.  */
-  _malloc_thread_enabled_p = 0;
-#endif
-
 #ifdef G_SLICE_ALWAYS_MALLOC
   /* This is used by the Cygwin build.  */
   xputenv ("G_SLICE=always-malloc");
@@ -1084,7 +1077,14 @@
     }
 
 #if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC
-  malloc_enable_thread ();
+# ifndef CANNOT_DUMP
+  /* Do not make gmalloc thread-safe when creating bootstrap-emacs, as
+     that causes an infinite recursive loop with FreeBSD.  But do make
+     it thread-safe when creating emacs, otherwise bootstrap-emacs
+     fails on Cygwin.  See Bug#14569.  */
+  if (!noninteractive || initialized)
+# endif
+    malloc_enable_thread ();
 #endif
 
   init_signals (dumping);


reply via email to

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