Bug 498166 - malloc_init deadlock due to pthread_atfork. r=glandium

This commit is contained in:
Leila Hadji 2015-05-22 06:01:00 -04:00
parent 7b9cbd7caf
commit f6b8d2a9b2

View File

@ -5838,11 +5838,6 @@ MALLOC_OUT:
#endif
}
#if !defined(MOZ_MEMORY_WINDOWS) && !defined(MOZ_MEMORY_DARWIN)
/* Prevent potential deadlock on malloc locks after fork. */
pthread_atfork(_malloc_prefork, _malloc_postfork, _malloc_postfork);
#endif
#ifndef MALLOC_STATIC_SIZES
/* Set variables according to the value of opt_small_max_2pow. */
if (opt_small_max_2pow < opt_quantum_2pow)
@ -6045,6 +6040,11 @@ MALLOC_OUT:
malloc_initialized = true;
#if !defined(MOZ_MEMORY_WINDOWS) && !defined(MOZ_MEMORY_DARWIN)
/* Prevent potential deadlock on malloc locks after fork. */
pthread_atfork(_malloc_prefork, _malloc_postfork, _malloc_postfork);
#endif
#if defined(NEEDS_PTHREAD_MMAP_UNALIGNED_TSD)
if (pthread_key_create(&mmap_unaligned_tsd, NULL) != 0) {
malloc_printf("<jemalloc>: Error in pthread_key_create()\n");