Date: Sat, 1 May 2004 12:57:17 -0500 (CDT) From: Archie Cobbs <archie@dellroad.org> To: eischen@vigrid.com, julian@elischer.org Cc: freebsd-threads@freebsd.org Subject: Re: libthr, libpthread problems Message-ID: <200405011757.i41HvHrM001972@arch20m.dellroad.org>
index | next in thread | raw e-mail
Dan Eischen wrote:
> On Thu, 29 Apr 2004, Michael Bretterklieber wrote:
> > currently I'm testing Mpd-4 on -current and It ran into deadlock,
> > therefore I changed the lib mapping via libmap.conf. When using libc_r
> > everything is ok, when using libpthread a deadlock occurs under some
> > circumstances, when using libthr, then:
> >
> > elvis:/home/mbretter/mpd/src# ./mpd
> > Multi-link PPP for FreeBSD, by Archie L. Cobbs.
> > Based on iij-ppp, by Toshiharu OHNO.
> > The mutex recurse count cannot be less than zero
>
> Sounds like a bug in the application (recurse count shouldn't
> be less than zero).
Nope.. here's a simpler test case that demonstrates the problem:
$ cat xx.c
#include <stdio.h>
#include <pthread.h>
#include <err.h>
static pthread_mutex_t mutex;
int
main(int argc, char **argv)
{
pthread_mutexattr_t mattr;
pthread_mutexattr_init(&mattr);
pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&mutex, &mattr);
pthread_mutexattr_destroy(&mattr);
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
return 0;
}
$ cc -g -Wall -o xx xx.o -pthread
$ ./xx
The mutex recurse count cannot be less than zero
Abnormal termination, file: /usr/src/lib/libthr/thread/thr_mutex.c, line: 677
Abort
$ uname -r
5.2-CURRENT
$ ldd ./xx
./xx:
libpthread.so.1 => /usr/lib/libthr.so.1 (0x2807b000)
libc.so.5 => /lib/libc.so.5 (0x28094000)
Seems to be PTHREAD_MUTEX_RECURSIVE-specific.
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405011757.i41HvHrM001972>
