diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2009-03-19 10:32:25 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2009-03-19 10:32:25 +0000 |
| commit | 29986e1bac92a068da1db1d7e68eb031e4fc49a7 (patch) | |
| tree | a0450674c2c0d99069b790fb48baa2337ceb6d84 /lib/libthr/thread | |
| parent | 839205949216ed4e0ae8df89ab24af3ccfce39e2 (diff) | |
Forcibly unlock the malloc() locks in the child process after fork(),
by temporary pretending that the process is still multithreaded.
Current malloc lock primitives do nothing for singlethreaded process.
Reviewed by: davidxu, deischen
Notes
svn path=/head/; revision=190025
Diffstat (limited to 'lib/libthr/thread')
| -rw-r--r-- | lib/libthr/thread/thr_fork.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c index bc410d1aa9e9..afb5a1db19df 100644 --- a/lib/libthr/thread/thr_fork.c +++ b/lib/libthr/thread/thr_fork.c @@ -173,8 +173,11 @@ _fork(void) /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); - if (unlock_malloc) + if (unlock_malloc) { + __isthreaded = 1; _malloc_postfork(); + __isthreaded = 0; + } /* Run down atfork child handlers. */ TAILQ_FOREACH(af, &_thr_atfork_list, qe) { |
