Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jul 2013 16:52:08 -0400
From:      Joe Marcus Clarke <>
To:        Andriy Gapon <>
Cc:        Daniel Eischen <>, Koop Mast <>,
Subject:   Re: Mutexes and error checking
Message-ID:  <>
In-Reply-To: <>
References:  <> <> <> <> <> <> <> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 7/21/13 12:26 PM, Andriy Gapon wrote:
> on 21/07/2013 19:02 Jilles Tjoelker said the following:
>> So I think allowing pthread_mutex_unlock() by a different thread would
>> be a step backwards.
> There is something else that bothers me too.
> Properly written code always "knows" whether it has a lock or not.  It does not
> try to unlock on a whim.  Apparently the software in question is not properly
> written.  Nevertheless, it takes care to check return status of
> pthread_mutex_unlock().  And, to add insult to injury, it depends on OS-specific
> behavior in doing so.  That seems like "two wrongs make a right" thing.

The specifics are this.  There are some GNOME/GTK+/GLib apps that are
crashing now that GLib checks the return of pthread_mutex_unlock() in
g_mutex_unlock().  While we can workaround this in GLib by simply
nop'ing the EPERM return, we'd like to pursue something that may be a
bit more manageable for those apps written for Linux that do not use GLib.

Again, I'm not arguing the voracity of the 3rd party app code, just the
discrepancy between Linux and Solaris compared to FreeBSD.


PGP Key :

Want to link to this message? Use this URL: <>