Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2003 18:02:46 -0400 (EDT)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        Petri Helenius <pete@he.iki.fi>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: malloc(): error: recursive call
Message-ID:  <Pine.GSO.4.10.10305271743040.9007-100000@pcnet1.pcnet.com>
In-Reply-To: <038a01c32495$6a1e17f0$812a40c1@PETEX31>

index | next in thread | previous in thread | raw e-mail

On Wed, 28 May 2003, Petri Helenius wrote:

> >And what does `ldd libnetsnmp.so.x`, `ldd libfoo.y`, show?
> 
> They give empty replies.
> 
> >What is `ldd yourexecutable` show?
> 
> Itīs usually linked static but if I remove the -static line it says:
>        libnetsnmp.so.5 => /usr/local/lib/libnetsnmp.so.5 (0x2807f000)
>         libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x280fe000)
>         libpcap.so.2 => /usr/lib/libpcap.so.2 (0x28209000)
>         libkse.so.1 => /usr/lib/libkse.so.1 (0x28225000)
>         libc.so.5 => /usr/lib/libc.so.5 (0x28246000)
> 
> >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.
> 
> 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 is
> 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īt include pthread.h
> to all object files because itīs not supposed to be neccessary. (only those
> which call pthread_* functions) The code is compiled on a machine with
> no SMP and run on both SMP and non-SMP machines.
> 
> 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.

-- 
Dan Eischen


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10305271743040.9007-100000>