libthr, libpthread problems

Daniel Eischen eischen at vigrid.com
Sun May 2 20:39:01 PDT 2004


On Mon, 3 May 2004, [iso-8859-1] Dag-Erling Sm=F8rgrav wrote:

> Archie Cobbs <archie at dellroad.org> writes:
> > Dan Eischen wrote:
> > > 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:
>=20
> Perfectly reproducable, definitely a libthr bug:

Yes, I replied yesterday with a patch to libthr to fix the problem,
but the @threads address was screwed up in the message header so it
never made the list.  Here it is again.

Index: thread/thr_mutex.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /opt/FreeBSD/cvs/src/lib/libthr/thread/thr_mutex.c,v
retrieving revision 1.25
diff -u -r1.25 thr_mutex.c
--- thread/thr_mutex.c=0929 Mar 2004 09:35:07 -0000=091.25
+++ thread/thr_mutex.c=091 May 2004 22:18:34 -0000
@@ -414,6 +414,8 @@
 =09=09/* Nothing */
 =09=09break;
 =09}
+=09if ((*mutex)->m_type =3D=3D PTHREAD_MUTEX_RECURSIVE)
+=09=09(*mutex)->m_data.m_count++;
 =09_thread_critical_exit(curthread);
 out:
 =09_SPINUNLOCK(&(*mutex)->lock);

--=20
Dan Eischen



More information about the freebsd-threads mailing list