bug 460993 prevent external-app deadlock on unix. patch=Jason Evans, r=pavlov, a=dveditz

git-svn-id: svn://10.0.0.236/trunk@255117 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dveditz%cruzio.com 2008-11-19 07:16:19 +00:00
parent ad78be4c4b
commit fed4d7017f

View File

@ -1199,6 +1199,9 @@ static
#endif #endif
bool malloc_init_hard(void); bool malloc_init_hard(void);
void _malloc_prefork(void);
void _malloc_postfork(void);
/* /*
* End function prototypes. * End function prototypes.
*/ */
@ -5489,6 +5492,11 @@ MALLOC_OUT:
#endif #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
/* Set variables according to the value of opt_small_max_2pow. */ /* Set variables according to the value of opt_small_max_2pow. */
if (opt_small_max_2pow < opt_quantum_2pow) if (opt_small_max_2pow < opt_quantum_2pow)
opt_small_max_2pow = opt_quantum_2pow; opt_small_max_2pow = opt_quantum_2pow;