Date: Thu, 3 Mar 2005 12:29:07 +0530 From: "Andriy Tkachuk" <andrit@ukr.net> To: <threads@freebsd.org> Subject: Re: patch for threads/76690 - critical - fork hang in child for -lc_r Message-ID: <001a01c51fbe$81472d60$090210ac@BORJA> References: <Pine.GSO.4.43.0503021042310.26125-100000@sea.ntplx.net>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
> This is already fixed in libpthread in both -current and -stable.
> Your patch also pollutes the application namespace with a global
> symbol thread_lock -- there is already a symbol in malloc.c that
> is there just for this purpose (__malloc_lock).
yea, i see - you right. i just didn't noticed that this one is already
without
static. thanks.
Ok, now the libc don't changed, and updated patch see in attachment.
Thanks,
Andriy.
[-- Attachment #2 --]
diff -r -u lib/libc_r/uthread/uthread_fork.c lib.patched/libc_r/uthread/uthread_fork.c
--- lib/libc_r/uthread/uthread_fork.c Fri Dec 10 09:06:45 2004
+++ lib.patched/libc_r/uthread/uthread_fork.c Thu Mar 3 12:17:01 2005
@@ -62,6 +62,9 @@
_pthread_mutex_lock(&_atfork_mutex);
+ extern spinlock_t *__malloc_lock;
+ _SPINLOCK(__malloc_lock);
+
/* Run down atfork prepare handlers. */
TAILQ_FOREACH_REVERSE(af, &_atfork_list, atfork_head, qe) {
if (af->prepare != NULL)
@@ -70,6 +73,8 @@
/* Fork a new process: */
if ((ret = __sys_fork()) != 0) {
+ _SPINUNLOCK(__malloc_lock);
+
/* Run down atfork parent handlers. */
TAILQ_FOREACH(af, &_atfork_list, qe) {
if (af->parent != NULL)
@@ -78,6 +83,8 @@
_pthread_mutex_unlock(&_atfork_mutex);
} else {
+ _SPINUNLOCK(__malloc_lock);
+
/* Close the pthread kernel pipe: */
__sys_close(_thread_kern_pipe[0]);
__sys_close(_thread_kern_pipe[1]);
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001a01c51fbe$81472d60$090210ac>
