Subject: Re: pthread_mutex_unlock
To: None <>
From: David H. Gutteridge <>
List: pkgsrc-users
Date: 01/17/2007 16:17:07
>I'm getting following error when running gftp:
>gftp-gtk: Error detected by libpthread: Unlocking unlocked mutex.
>Detected by file "/usr/src/lib/libpthread/pthread_mutex.c", line 369,
>function "pthread_mutex_unlock".

>I thought I could patch gftp upstream, but the code looks fine to me.

>I think this problem is known, but what is the solution ? (except

I PRed this back in 2005, it's here:

This isn't really something that's fair for pkgsrc to tackle, from what
I could see from the code.  (So my PR should probably be suspended or
closed.)  To second Joerg's comment, in the gtkui.c code (as of mid-
2005 anyway), the code is a bit tangled up in the sense that there can
be multiple calls of GDK_THREADS_LEAVE(), and it's not a simple matter
of changing a line or two; it appeared to me that there were multiple
potential points of entry to several code blocks that were causing the

I never bothered PRing it upstream, but if someone was to do so, they
might want to point out that this problem can (presumably) be
duplicated on other OSes like Linux by enabling glib2's
G_ERRORCHECK_MUTEXES macro, which makes glib2 handle these excess calls
like NetBSD does.