From owner-freebsd-threads@FreeBSD.ORG Sun Jul 21 16:28:05 2013 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AC42BE39; Sun, 21 Jul 2013 16:28:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id BF7BA91D; Sun, 21 Jul 2013 16:28:04 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA01272; Sun, 21 Jul 2013 19:27:51 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1V0wUA-000KBm-Tu; Sun, 21 Jul 2013 19:27:50 +0300 Message-ID: <51EC0BCF.6080501@FreeBSD.org> Date: Sun, 21 Jul 2013 19:26:55 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130708 Thunderbird/17.0.7 MIME-Version: 1.0 To: Joe Marcus Clarke , Daniel Eischen Subject: Re: Mutexes and error checking References: <51E71D4F.5030502@marcuscom.com> <51E8061B.60906@marcuscom.com> <51EB5EC4.6050802@marcuscom.com> <20130721160220.GA38417@stack.nl> In-Reply-To: <20130721160220.GA38417@stack.nl> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Koop Mast , freebsd-threads@FreeBSD.org X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jul 2013 16:28:05 -0000 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. I understand that "life is such", etc, but it hurts to see us bend for such a backwards code. -- Andriy Gapon