libthr, libpthread problems
Archie Cobbs
archie at dellroad.org
Sat May 1 13:02:37 PDT 2004
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
More information about the freebsd-threads
mailing list