Kostik Belousov wrote:
I looked at the issue once more recently, and I propose the following
much less intrusive patch. It is somewhat hackish, but I think that
it would be good to have this working. Most other Unixes do have
working thread library after the fork. Any objections ?

diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c
index bc410d1..ae6b9ad 100644
--- a/lib/libthr/thread/thr_fork.c
+++ b/lib/libthr/thread/thr_fork.c
@@ -173,14 +173,19 @@ _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) {
                        if (af->child != NULL)
                                af->child();
                }
+
+               THR_UMUTEX_UNLOCK(curthread, &_thr_atfork_lock);

^^^
This line is not needed.

        } else {
                /* Parent process */
                errsave = errno;



_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to