From owner-freebsd-threads@FreeBSD.ORG Tue May 27 15:02:47 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D715137B401 for ; Tue, 27 May 2003 15:02:47 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2144F43FAF for ; Tue, 27 May 2003 15:02:47 -0700 (PDT) (envelope-from eischen@pcnet1.pcnet.com) Received: from pcnet1.pcnet.com (localhost [127.0.0.1]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h4RM2kwQ013114; Tue, 27 May 2003 18:02:46 -0400 (EDT) Received: from localhost (eischen@localhost)h4RM2kCi013111; Tue, 27 May 2003 18:02:46 -0400 (EDT) Date: Tue, 27 May 2003 18:02:46 -0400 (EDT) From: Daniel Eischen To: Petri Helenius In-Reply-To: <038a01c32495$6a1e17f0$812a40c1@PETEX31> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE cc: freebsd-threads@freebsd.org Subject: Re: malloc(): error: recursive call X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2003 22:02:48 -0000 On Wed, 28 May 2003, Petri Helenius wrote: > >And what does `ldd libnetsnmp.so.x`, `ldd libfoo.y`, show? >=20 > They give empty replies. >=20 > >What is `ldd yourexecutable` show? >=20 > It=B4s usually linked static but if I remove the -static line it says: > libnetsnmp.so.5 =3D> /usr/local/lib/libnetsnmp.so.5 (0x2807f000) > libcrypto.so.3 =3D> /usr/lib/libcrypto.so.3 (0x280fe000) > libpcap.so.2 =3D> /usr/lib/libpcap.so.2 (0x28209000) > libkse.so.1 =3D> /usr/lib/libkse.so.1 (0x28225000) > libc.so.5 =3D> /usr/lib/libc.so.5 (0x28246000) >=20 > >malloc is thread safe and we've been using it fine > >with all our tests. I suspect you're using another > >library that is using libc_r or something. >=20 > malloc works for me with for example linuxthreads. So I do believe that > the the trigger for malloc locking works, however looking at the code, > spinlocks are implemented differently depending on which thread library i= s > linked in. I'm going to need a sample. Nothing I have here has this problem, from KDE & mozilla, to the ACE tests. There's also a patch for spinlocks at: http://people.freebsd.org/~deischen/kse/spinlock.diffs This is just a different way for libkse to do spinlocks, and I don't see how it's going to solve your problem, but you can try it. > I have only I686_CPU on my kernel config and I don=B4t include pthread.h > to all object files because it=B4s not supposed to be neccessary. (only t= hose > which call pthread_* functions) The code is compiled on a machine with > no SMP and run on both SMP and non-SMP machines. >=20 > Do I understand correctly that libkse mutexes always require syscall > when locking and unlocking? No, it doesn't. It only requires syscalls when a thread's parent KSE has no more threads to run. --=20 Dan Eischen