diff options
| author | Paul Eggert | 2013-07-03 23:20:55 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-07-03 23:20:55 -0700 |
| commit | 2c1c974b061b14ec69b29c436214b0350872f14c (patch) | |
| tree | 7b21efad2e4b150316f7b34552579a2a4490a06d /src | |
| parent | 8b09455e9cc38c741183469b3381b67254472fe5 (diff) | |
| download | emacs-2c1c974b061b14ec69b29c436214b0350872f14c.tar.gz emacs-2c1c974b061b14ec69b29c436214b0350872f14c.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/emacs.c | 16 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f8d54c7fb03..1bd53573086 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-07-04 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Try again to fix FreeBSD bug re multithreaded memory alloc (Bug#14569). | ||
| 4 | * emacs.c (main) [HAVE_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]: | ||
| 5 | Do not clear _malloc_thread_enabled_p, undoing the previous change, | ||
| 6 | which did not work (see <http://bugs.gnu.org/14569#307>). | ||
| 7 | (main): Do not invoke malloc_enable_thread if (! CANNOT_DUMP | ||
| 8 | && (!noninteractive || initialized)). This attempts to thread | ||
| 9 | the needle between the Scylla of FreeBSD and the Charybdis of Cygwin. | ||
| 10 | |||
| 1 | 2013-07-04 Juanma Barranquero <lekktu@gmail.com> | 11 | 2013-07-04 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 12 | ||
| 3 | * image.c (x_to_xcolors) [HAVE_NTGUI]: Remove unused var `hdc'. | 13 | * image.c (x_to_xcolors) [HAVE_NTGUI]: Remove unused var `hdc'. |
diff --git a/src/emacs.c b/src/emacs.c index bebc5e420ad..4b709527ff0 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -128,7 +128,6 @@ extern int malloc_set_state (void*); | |||
| 128 | dumping. Used to work around a bug in glibc's malloc. */ | 128 | dumping. Used to work around a bug in glibc's malloc. */ |
| 129 | static bool malloc_using_checking; | 129 | static bool malloc_using_checking; |
| 130 | #elif defined HAVE_PTHREAD && !defined SYSTEM_MALLOC | 130 | #elif defined HAVE_PTHREAD && !defined SYSTEM_MALLOC |
| 131 | extern int _malloc_thread_enabled_p; | ||
| 132 | extern void malloc_enable_thread (void); | 131 | extern void malloc_enable_thread (void); |
| 133 | #endif | 132 | #endif |
| 134 | 133 | ||
| @@ -682,12 +681,6 @@ main (int argc, char **argv) | |||
| 682 | stack_base = &dummy; | 681 | stack_base = &dummy; |
| 683 | #endif | 682 | #endif |
| 684 | 683 | ||
| 685 | #if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC | ||
| 686 | /* Disable mutexes in gmalloc.c. Otherwise, FreeBSD Emacs recursively | ||
| 687 | loops with pthread_mutex_lock calling calloc and vice versa. */ | ||
| 688 | _malloc_thread_enabled_p = 0; | ||
| 689 | #endif | ||
| 690 | |||
| 691 | #ifdef G_SLICE_ALWAYS_MALLOC | 684 | #ifdef G_SLICE_ALWAYS_MALLOC |
| 692 | /* This is used by the Cygwin build. */ | 685 | /* This is used by the Cygwin build. */ |
| 693 | xputenv ("G_SLICE=always-malloc"); | 686 | xputenv ("G_SLICE=always-malloc"); |
| @@ -1084,7 +1077,14 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1084 | } | 1077 | } |
| 1085 | 1078 | ||
| 1086 | #if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC | 1079 | #if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC |
| 1087 | malloc_enable_thread (); | 1080 | # ifndef CANNOT_DUMP |
| 1081 | /* Do not make gmalloc thread-safe when creating bootstrap-emacs, as | ||
| 1082 | that causes an infinite recursive loop with FreeBSD. But do make | ||
| 1083 | it thread-safe when creating emacs, otherwise bootstrap-emacs | ||
| 1084 | fails on Cygwin. See Bug#14569. */ | ||
| 1085 | if (!noninteractive || initialized) | ||
| 1086 | # endif | ||
| 1087 | malloc_enable_thread (); | ||
| 1088 | #endif | 1088 | #endif |
| 1089 | 1089 | ||
| 1090 | init_signals (dumping); | 1090 | init_signals (dumping); |